Skip to content

Add Level 3 Products to Web Application#1753

Open
mfixstsci wants to merge 25 commits intospacetelescope:developfrom
mfixstsci:add-level3-radio-buttons
Open

Add Level 3 Products to Web Application#1753
mfixstsci wants to merge 25 commits intospacetelescope:developfrom
mfixstsci:add-level3-radio-buttons

Conversation

@mfixstsci
Copy link
Copy Markdown
Collaborator

This PR covers work that will include thumbnails and pngs of level three products and display them in the web application.


if len(thumbnails) > 0:
preferred = [thumb for thumb in thumbnails if 'rate' in thumb]
preferred = [thumb for thumb in thumbnails]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing with this today before I realized you had already looked into it. Below is what I came up with to try and make sure we use rate files for level 2 thumbnails, and "more interesting" thumbnails for the level 3 files. Since the list of thumbnail files is sorted, for level 2 rootnames, what you have should work, because it'll find the cal files first, which should work just as well as rate files. But for level 3, it would find cal or crf first, which I guess would be ok, but it wouldn't highlight that the file is a level 3 file. I know what's below is ugly, but with something along these lines, we could be sure to use a thumbnail from an x1d if it exists. And the nice thing here is that this is totally independent of what suffixes we will eventually choose to make thumbnails for, so maintenance in the future should be zero.

if len(thumbnails) > 0:
    preferred = [thumb for thumb in thumbnails if 'rate' in thumb]
    if len(preferred) == 0:
        preferred = [thumb for thumb in thumbnails if 'dark' in thumb]
    if len(preferred) == 0:
        level3_suffixes = ['x1d', 'x1dints', 'phot', 'whtlt', 's2d', 's3d', 'i2d', 'crf', 'cal', 'psfsub', 'psfstack', 'ami-oi', 'amimulti-oi', 'aminorm-oi']
        for suffix in level3_suffixes:
            preferred = [thumb for thumb in thumbnails if suffix in thumb]
            print(suffix, preferred)
            if len(preferred) > 0:
                break
    if len(preferred) > 0:
        thumbnail_basename = os.path.basename(preferred[0])

proposal_dir, ac_id = rootname.split('_')[0].split("-")
filenames = glob.glob(
os.path.join(FILESYSTEM_DIR, 'public', proposal_dir, "L3",
"t", ac_id,'{}*'.format(rootname)))
Copy link
Copy Markdown
Collaborator

@bhilbert4 bhilbert4 Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line won't find all the L3 files, because there are other subdir options other than the current "t". There can also be "s". I ended up making this same fix in the PR for the exposure level pages, although not as cleverly as you have here with the regex.

"t", ac_id,'{}*'.format(rootname)))
filenames.extend(glob.glob(
os.path.join(FILESYSTEM_DIR, 'proprietary', proposal_dir, "L3",
"t", ac_id, '{}*'.format(rootname))))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line won't find all the L3 files, because there are other subdir options other than the current "t". There can also be "s". I ended up making this same fix in the PR for the exposure level pages, although not as cleverly as you have here with the regex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants