-
Notifications
You must be signed in to change notification settings - Fork 76
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
Hide Cubeviz import button after importing data #1495
Changes from 4 commits
1a14958
1c28ea0
9afb1c2
94e9d62
2489839
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,22 @@ def _set_spectrum_x_axis(self, msg): | |
else: | ||
viewer.state.x_att_pixel = ref_data.id["Pixel Axis 2 [x]"] | ||
|
||
def load_data(self, data, **kwargs): | ||
""" | ||
Load and parse a data cube with Cubeviz. | ||
(Note that only one cube may be loaded per Cubeviz instance.) | ||
|
||
Parameters | ||
---------- | ||
data : str or `~astropy.io.fits.HDUList` | ||
A string file path or astropy FITS object pointing to the | ||
data cube. | ||
""" | ||
if len(self.app.state.data_items) != 0: | ||
raise RuntimeError('only one cube may be loaded per Cubeviz instance') | ||
Comment on lines
+52
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just realized that some day we might want to allow loading 1d spectra and only forbid cubes, but that will require quite a bit more advanced logic, especially on the UI side, so I think this is fine for now until/unless we get a request to re-enable that. |
||
|
||
super().load_data(data, parser_reference="cubeviz-data-parser", **kwargs) | ||
|
||
def select_slice(self, slice): | ||
""" | ||
Select a slice by index. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ def parse_data(app, file_obj, data_type=None, data_label=None): | |
---------- | ||
app : `~jdaviz.app.Application` | ||
The application-level object used to reference the viewers. | ||
file_path : str | ||
file_obj : str | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not quite groking this change here; the docstring still explicitly states "path" , so presumably if this change is to explicitly allowing a Spectrum1D to be loaded directly, then I think the docstring should be updated too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mainly did this for consistency – if you search, |
||
The path to a cube-like data file. | ||
data_type : str, {'flux', 'mask', 'uncert'} | ||
The data type used to explicitly differentiate parsed data. | ||
|
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.
could probably either make the first (empty)
v-if
entry a div instead of a j-tooltip and/or invert the v-if and not render any entry in the case of hiding the import button (but that might be harder logic to parse).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.
Giving both the same element seemed more intuitive to me. I did want to put the conditional for hiding in the
v-else
statement since it's rarer, but the logic for thev-if
seems like it would need to be long – I get something likev-if="(config !== 'cubeviz') || ((config == 'cubeviz') && (item.name !== 'g-data-tools' || (item.name == 'g-data-tools' && state.data_items.length == 0)))"
.