Skip to content

Commit

Permalink
input download progress tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
LTDakin committed Oct 9, 2024
1 parent 80fcb80 commit 9e3777d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
5 changes: 4 additions & 1 deletion datalab/datalab_session/data_operations/median.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def operate(self):
comment = f'Datalab Median on {", ".join([image["basename"] for image in input_list])}'
log.info(comment)

input_FITS_list = [FITSFileReader(input['basename'], input['source']) for input in input_list]
input_FITS_list = []
for index, input in enumerate(input_list, start=1):
input_FITS_list.append(FITSFileReader(input['basename'], input['source']))
self.set_operation_progress(0.5 * (index / len(input_list)))

# Creating the Median array
cropped_data = crop_arrays([image.sci_data for image in input_FITS_list])
Expand Down
5 changes: 4 additions & 1 deletion datalab/datalab_session/data_operations/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def operate(self):
input_list = self.input_data.get('input_files', [])
log.info(f'Normalization operation on {len(input_list)} file(s)')

input_FITS_list = [FITSFileReader(input['basename'], input['source']) for input in input_list]
input_FITS_list = []
for index, input in enumerate(input_list, start=1):
input_FITS_list.append(FITSFileReader(input['basename'], input['source']))
self.set_operation_progress(0.5 * (index / len(input_list)))

output_files = []
for index, image in enumerate(input_FITS_list, start=1):
Expand Down
6 changes: 4 additions & 2 deletions datalab/datalab_session/data_operations/rgb_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ def operate(self):
rgb_comment = f'Datalab RGB Stack on files {", ".join([image["basename"] for image in rgb_input_list])}'
log.info(rgb_comment)

input_FITS_list = [FITSFileReader(input['basename'], input['source']) for input in rgb_input_list]
self.set_operation_progress(0.4)
input_FITS_list = []
for index, input in enumerate(rgb_input_list, start=1):
input_FITS_list.append(FITSFileReader(input['basename'], input['source']))
self.set_operation_progress(0.4 * (index / len(rgb_input_list)))

fits_file_list = [image.fits_file for image in input_FITS_list]
large_jpg_path, small_jpg_path = create_jpgs(self.cache_key, fits_file_list, color=True)
Expand Down
6 changes: 4 additions & 2 deletions datalab/datalab_session/data_operations/stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ def operate(self):
comment= f'Datalab Stacking on {", ".join([image["basename"] for image in input_files])}'
log.info(comment)

input_FITS_list = [FITSFileReader(input['basename'], input['source']) for input in input_files]
self.set_operation_progress(0.4)
input_FITS_list = []
for index, input in enumerate(input_files, start=1):
input_FITS_list.append(FITSFileReader(input['basename'], input['source']))
self.set_operation_progress(0.5 * (index / len(input_files)))

cropped_data = crop_arrays([image.sci_data for image in input_FITS_list])
stacked_ndarray = np.stack(cropped_data, axis=2)
Expand Down
7 changes: 5 additions & 2 deletions datalab/datalab_session/data_operations/subtraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ def operate(self):

log.info(f'Subtraction operation on {len(input_files)} files')

input_FITS_list = [FITSFileReader(input['basename'], input['source']) for input in input_files]
subtraction_FITS = FITSFileReader(subtraction_file_input[0]['basename'], subtraction_file_input[0]['source'])
self.set_operation_progress(0.5)
input_FITS_list = [FITSFileReader(input['basename'], input['source']) for input in input_files]
input_FITS_list = []
for index, input in enumerate(input_files, start=1):
input_FITS_list.append(FITSFileReader(input['basename'], input['source']))
self.set_operation_progress(0.5 * (index / len(input_files)))

outputs = []
for index, input_image in enumerate(input_FITS_list, start=1):
Expand Down

0 comments on commit 9e3777d

Please sign in to comment.