-
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
Link mosviz data as a batch after they are loaded #762
Changes from 14 commits
cc13d6b
1f7604a
93cd249
60ca838
aab771a
61932e9
51352a7
7f63f27
c62fbdb
4504a24
2572568
19ac2ad
d5a6ba7
7939d2c
60ce746
5aa6080
dbafddf
8486e82
7e2369e
37c9d34
8ef5878
8084945
6d25c70
592b3f6
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 |
---|---|---|
|
@@ -14,8 +14,8 @@ class MosViz(ConfigHelper): | |
|
||
_default_configuration = "mosviz" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
spec1d = self.app.get_viewer("spectrum-viewer") | ||
spec1d.scales['x'].observe(self._update_spec2d_x_axis) | ||
|
@@ -131,6 +131,7 @@ def load_data(self, spectra_1d, spectra_2d, images=None, spectra_1d_label=None, | |
``images``. Can be a list of strings representing data labels | ||
for each item in ``data_obj`` if ``data_obj`` is a list. | ||
""" | ||
self.app.auto_link = False | ||
|
||
# If we have a single image for multiple spectra, tell the table viewer | ||
if not isinstance(images, (list, tuple)) and isinstance(spectra_1d, (list, tuple)): | ||
|
@@ -145,6 +146,21 @@ def load_data(self, spectra_1d, spectra_2d, images=None, spectra_1d_label=None, | |
|
||
self.load_2d_spectra(spectra_2d, spectra_2d_label) | ||
self.load_1d_spectra(spectra_1d, spectra_1d_label) | ||
self.link_table_data(None) | ||
|
||
javerbukh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self.app.auto_link = True | ||
|
||
def link_table_data(self, data_obj): | ||
""" | ||
Batch link data in the Mosviz table rather than doing it on | ||
data load. | ||
|
||
Parameters | ||
---------- | ||
data_obj : obj | ||
Input for Mosviz data parsers. | ||
""" | ||
super().load_data(data_obj, parser_reference="mosviz-link-data") | ||
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 out of interest, what is the motivation for doing the linking as a parser as opposed to just a method? 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 think it was to keep all related code in one file and have the linking method be callable from the helper file, which (if I remember correctly) can only be done using |
||
|
||
def load_metadata(self, data_obj): | ||
""" | ||
|
@@ -195,7 +211,12 @@ def load_2d_spectra(self, data_obj, data_labels=None): | |
data_labels=data_labels) | ||
|
||
def load_niriss_data(self, data_obj, data_labels=None): | ||
self.app.auto_link = False | ||
|
||
super().load_data(data_obj, parser_reference="mosviz-niriss-parser") | ||
self.link_table_data(data_obj) | ||
|
||
self.app.auto_link = True | ||
|
||
def load_images(self, data_obj, data_labels=None, share_image=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.
This doesn't actually work properly is
auto_link
is passed to the initializer as theauto_link
option is first passed to the parent class in thesuper().__init__
call and is then not recognized. For this to work it has to come before thesuper()
call I think.