-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update/hackathon feedback #35
Changes from 5 commits
4f91efc
26ed7f5
e0411d1
7ee0233
6130cb0
69ae917
9564803
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 |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
|
||
from datalab.datalab_session.data_operations.data_operation import BaseDataOperation | ||
from datalab.datalab_session.exceptions import ClientAlertException | ||
from datalab.datalab_session.file_utils import get_fits, crop_arrays, create_fits, create_jpgs | ||
from datalab.datalab_session.s3_utils import save_fits_and_thumbnails | ||
from datalab.datalab_session.file_utils import create_output, crop_arrays, create_jpgs | ||
from datalab.datalab_session.s3_utils import get_fits | ||
|
||
log = logging.getLogger() | ||
log.setLevel(logging.INFO) | ||
|
@@ -59,30 +59,28 @@ def wizard_description(): | |
def operate(self): | ||
rgb_input_list = self.input_data['red_input'] + self.input_data['green_input'] + self.input_data['blue_input'] | ||
|
||
if len(rgb_input_list) == 3: | ||
log.info(f'Executing RGB Stack operation on files: {rgb_input_list}') | ||
if len(rgb_input_list) != 3: | ||
raise ClientAlertException('RGB stack requires exactly 3 files') | ||
|
||
log.info(f'Executing RGB Stack operation on files: {rgb_input_list}') | ||
|
||
fits_paths = [] | ||
for file in rgb_input_list: | ||
fits_paths.append(get_fits(file.get('basename'))) | ||
self.set_percent_completion(self.get_percent_completion() + 0.2) | ||
large_jpg_path, small_jpg_path = create_jpgs(self.cache_key, fits_paths, color=True) | ||
fits_paths = [] | ||
for file in rgb_input_list: | ||
fits_paths.append(get_fits(file.get('basename'))) | ||
self.set_operation_progress(self.get_operation_progress() + 0.2) | ||
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. This is a generic comment and I know we had already been doing this before, but calling the |
||
|
||
large_jpg_path, small_jpg_path = create_jpgs(self.cache_key, fits_paths, color=True) | ||
|
||
# color photos take three files, so we store it as one fits file with a 3d SCI ndarray | ||
arrays = [fits.open(file)['SCI'].data for file in fits_paths] | ||
cropped_data_list = crop_arrays(arrays) | ||
stacked_data = np.stack(cropped_data_list, axis=2) | ||
|
||
fits_file = create_fits(self.cache_key, stacked_data) | ||
# color photos take three files, so we store it as one fits file with a 3d SCI ndarray | ||
arrays = [fits.open(file)['SCI'].data for file in fits_paths] | ||
cropped_data_list = crop_arrays(arrays) | ||
stacked_data = np.stack(cropped_data_list, axis=2) | ||
|
||
output_file = save_fits_and_thumbnails(self.cache_key, fits_file, large_jpg_path, small_jpg_path) | ||
self.set_operation_progress(0.8) | ||
|
||
rgb_comment = f'Product of Datalab RGB Stack on files {", ".join([image["basename"] for image in rgb_input_list])}' | ||
output = create_output(self.cache_key, stacked_data, large_jpg=large_jpg_path, small_jpg=small_jpg_path, comment=rgb_comment) | ||
|
||
output = {'output_files': [output_file]} | ||
else: | ||
output = {'output_files': []} | ||
raise ClientAlertException('RGB Stack operation requires exactly 3 input files') | ||
|
||
self.set_percent_completion(1.0) | ||
self.set_operation_progress(1.0) | ||
self.set_output(output) | ||
log.info(f'RGB Stack output: {self.get_output()}') |
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.
A lot of the operation progress is used when downloading input files to work on. It seems bad to remove any reporting of that progress. I.e. if you do an operation with 100 images, you will sit there with 0% progress for a long while before it finishes loading all 100 images. Can we retain the reporting of progress up to some maximum based on the number of images its downloading?
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.
Yeah.. it's a lot harder to track the progress like you said, downloading is most of the work for many operations. I also was dubious about removing the download percent. Next time I should call a meeting to go over the feedback on whether we should action on it or not. Customer isn't always right haha