Skip to content

Commit

Permalink
adjust percentages, remove logging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
LTDakin committed Sep 16, 2024
1 parent c6a7ad3 commit 9a5d3fc
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions datalab/datalab_session/data_operations/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def name():
def description():
return """The normalize operation takes in 1..n input images and calculates each image's median value and divides every pixel by that value.
The output is a normalized image for the n input images. This operation is commonly used as a precursor step for flat removal."""
The output is a normalized image. This operation is commonly used as a precursor step for flat removal."""

@staticmethod
def wizard_description():
Expand All @@ -43,23 +43,24 @@ def operate(self):

input = self.input_data.get('input_files', [])

log.info(f'Executing normalization operation on {len(input)} file(s) {input}')
log.info(f'Executing normalization operation on {len(input)} file(s)')

image_data_list = self.get_fits_npdata(input)
self.set_percent_completion(0.40)

image_data_list = self.get_fits_npdata(input, percent=0.4, cur_percent=0.0)
log.info(f'image data list: {image_data_list}')
output_files = []
for i, image in enumerate(image_data_list):
for index, image in enumerate(image_data_list):
median = np.median(image)
normalized_image = image / median

fits_file = create_fits(self.cache_key, normalized_image)
log.info(f'fits_file: {fits_file}')
large_jpg_path, small_jpg_path = create_jpgs(self.cache_key, fits_file)
output_file = save_fits_and_thumbnails(self.cache_key, fits_file, large_jpg_path, small_jpg_path, index=i)
output_file = save_fits_and_thumbnails(self.cache_key, fits_file, large_jpg_path, small_jpg_path, index=index)
output_files.append(output_file)
log.info(f'x: {output_files}')

self.set_percent_completion(self.get_percent_completion() + .40 * (index + 1) / len(input))

output = {'output_files': output_files}

self.set_percent_completion(1.0)
self.set_output(output)
log.info(f'Normalization output: {self.get_output()}')

0 comments on commit 9a5d3fc

Please sign in to comment.