-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creation of IRISMapCubeSequence class #83
Creation of IRISMapCubeSequence class #83
Conversation
irispy/new_sji.py
Outdated
""" | ||
def __init__(self, data_list, meta=None, common_axis=0): | ||
# Check that all SJI data are coming from the same OBS ID. | ||
if len(np.unique([cube.meta["OBSID"] for cube in data_list])) != 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be rewritten as:
if any([cube.meta["OBSID"] for cube in data_list] != data_list[0].meta["OBSID"]):
The list might have to be an array. I'm not sure. Check this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this line, I get an error that I solve by doing :
if np.any([cube.meta["OBSID"] != data_list[0].meta["OBSID"] for cube in data_list]):
irispy/new_sji.py
Outdated
extra_coords=extra_coords, scaled=scaled)) | ||
hdulist.close() | ||
|
||
return IRISMapCubeSequence(list_of_cubes, meta=meta, common_axis=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an IRISMapCubeSequence
should only be returned if there is more than one file input. Otherwise, an IRISMapCube
should be returned as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is boring to use it with only one file (I am working with). I will modify it.
Thanks for this PR @BaptistePellorceAstro. I made a couple of minor initial comments. This has brought up a larger issue in my mind. That is, how should the In principle this could be done by rewriting the |
irispy/new_sji.py
Outdated
filename : `str` | ||
File name to be read | ||
filenames: `list` of `str` or `str` | ||
Filename of filenames to be read. They must all be associated with the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "of" should be "or"
Hi, as you said, I have some problems :
|
irispy/new_sji.py
Outdated
@@ -274,7 +274,7 @@ def __repr__(self): | |||
|
|||
def __getitem__(self, item): | |||
return utils.sequence.slice_sequence(self, item) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use utils.sequence.slice_sequence(self, item)
rather than index_as_cube
because the last function is calling a lot of function that are not relevant (creating as many error as functions) and return the same result. What do you think about it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should call index_as_cube
. The extra checks it does make it more rigorous. We just need to get it working here. And I think simply calling utils.sequence.slice_sequence
will not always be correct. The way you should call index_as_cube
it is:
return self.index_as_cube[item]
Have you tried this? If so, what errors are you getting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it works !
Hi @BaptistePellorceAstro. I just noticed how long ago you sent your first comment since I last looked at this. Apologies for the delay in replying. I've left a couple comments to get you going again. I'll also look into the |
@BaptistePellorceAstro, I think the solution to the
Does this make sense? |
Thanks for your help, now everything is working. I opened a new PR in ndcube to solve the cycling bug. |
irispy/new_sji.py
Outdated
|
||
@property | ||
def cube_dimensions(self): | ||
def dimensions(self): | ||
return self.cube_like_dimensions | ||
|
||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think I told you to call this property world_axis_physical_coords
. It was a typo. It should have the same name as the NDCubeSequence
method which is world_axis_physical_types
. My mistake. THis means it also needs changing in line 276 well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified
@@ -101,11 +103,14 @@ def __repr__(self): | |||
#Conversion of the end date of OBS | |||
endobs = self.meta.get("ENDOBS", None) | |||
endobs = endobs.isoformat() if endobs else None | |||
#Conversion of the instance start of OBS | |||
instance_start = self.extra_coords["TIME"]["value"][0] | |||
#Conversion of the instance start and end of OBS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so you know, the convention of comments is to use a space between the # and the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, I just forget to add a space.
Hi @BaptistePellorceAstro. I think this PR is almost ready to merge! :) I just asked for a method name change that was originally my fault for giving you the wrong name. See above comment. |
If everything is OK for you, I am ready to merge. |
Another merged PR! You're flying through them! |
Here the creation of the IRISMapCubeSequence class. See #72 for more informations.