spacetelescope / jwql

The James Webb Space Telescope Quicklook Application
BSD 3-Clause "New" or "Revised" License
64 stars 43 forks source link

Enable "advanced" preview images #80

Closed bourque closed 6 years ago

bourque commented 6 years ago

During the meeting with the NIRCam team, they expressed interest in having preview images that includes a mosaic with all detectors that were observed during a particular observation. Perhaps this could be an option for a preview image to view on the web application.

bourque commented 6 years ago

Assigning to @bhilbert4 for when he gets back, since he is most familiar with the preview_image code.

bhilbert4 commented 6 years ago

One question that's come up as part of this work has to do with directory naming conventions. Currently, for a file named jw12345001001_00000_0111d_NRCA1_cal.fits, a directory called jw54321001001_00000_0111d_NRCA1_cal will be created, within which the preview image, called jw54321001001_00000_0111d_NRCA1_cal_integ0.jpg will be placed.

But now, if we are creating a single mosaicked preview image from: jw12345001001_00000_0111d_NRCA1_cal.fits, jw12345001001_00000_0111d_NRCA2_cal.fits, jw12345001001_00000_0111d_NRCA3_cal.fits, jw12345001001_00000_0111d_NRCA4_cal.fits

what should the name of the directory be? Should we just use the directory name from the first file in the list (NRCA1)? Or should we create something to indicate a mosaic `(e.g. jw54321001001_00000_0111d_NRC_SWA_MOSAIC_cal'

The latter is what I am currently doing with the filenames of the jpg images. (e.g. jw54321001001_00000_0111d_NRC_SWA_MOSAIC_cal_integ0.jpg

My convention at the moment for filenames is to have a unique suffix for each kind of mosaic: For longwave channel data: NRC_LW_MOSAIC For shortwave channel data from both modules: NRC_SWALL_MOSAIC For shortwave channel data from module A only: NRC_SWA_MOSAIC For shortwave channel data from module B only: NRC_SWB_MOSAIC

bhilbert4 commented 6 years ago

I just want to make sure that other parts of the code know where to look for the preview images.

bourque commented 6 years ago

@bhilbert4 I am a little confused. Are you referring to how the JPEGs should be organized and stored in our filesystem on central storage? During the first wave of preview image generation, we just had parent directories pertaining to Program ID (e.g. jw00300/), and had any JPEG that pertained to that program saved within. Could we keep doing that?

As for the JPEG filenames themselves, I think your NRC_LW_MOSAIC, NRC_SWALL_MOSAIC, NRC_SWA_MOSAIC, NRC_SWB_MOSAIC makes sense.

bhilbert4 commented 6 years ago

Hmm ok. I played a little with the preview image filesystem variable since I'm working on my local machine. Looks like I set it up such that generate_preview_image fell into the except statement below:

try: identifier = 'jw{}'.format(filename_parser(file_list[0])['program_id']) except ValueError as error: identifier = os.path.basename(file_list[0]).split('.fits')[0] In that case the directory name is the name of the fits file minus the fits. Are we ever going to fall into that when working with actual data? If not, maybe we should just have the except raise an Error?

bourque commented 6 years ago

@bhilbert4 Ahhh yes, I wrote that exception to get around occasional exceptions raised by filename_parser() on JWST files with strange filenames. In that case, yes, I default to just the full filename.

I didn't think this was a common occurrence. Are you seeing many/most of the files choke on this part? If so, I think we will need to make filename_parser() a bit more robust to handle non-standard JWST filenames. (Or perhaps the standard has changed since we first wrote filename_parser()?)

bhilbert4 commented 6 years ago

Ok. I'm getting that with my test files, but I think that's just because of the way I've modified things for testing. Actually I guess you'll see that when I open the PR. I left those changes in there because there are probably still more tests for me to do.

bourque commented 6 years ago

See #116