Skip to content

Commit

Permalink
Merge branch 'develop' into bad-pixel-monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
bourque authored Jun 30, 2020
2 parents 2f1430c + 5e67b72 commit fac940b
Show file tree
Hide file tree
Showing 15 changed files with 962 additions and 32 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,22 @@ Any questions about the `jwql` project or its software can be directed to `jwql@

## Current Development Team
- Matthew Bourque (INS) [@bourque](https://github.com/bourque)
- Lauren Chambers (INS) [@laurenmarietta](https://github.com/laurenmarietta)
- Misty Cracraft (INS) [@cracraft](https://github.com/cracraft)
- Joe Filippazzo (INS) [@hover2pi](https://github.com/hover2pi)
- Mike Engesser (INS) [@mengesser](https://github.com/mengesser)
- Mees Fix (INS) [@mfixstsci](https://github.com/mfixstsci)
- Bryan Hilbert (INS) [@bilhbert4](https://github.com/bhilbert4)
- Graham Kanarek (INS) [@gkanarek](https://github.com/gkanarek)
- Teagan King (INS) [@tnking97](https://github.com/tnking97)
- Maria Pena-Guerrero [@penaguerrero](https://github.com/penaguerrero)
- Ben Sunnquist (INS) [@bsunnquist](https://github.com/bsunnquist)

## Past Development Team Members
- Lauren Chambers (INS) [@laurenmarietta](https://github.com/laurenmarietta)
- Joe Filippazzo (INS) [@hover2pi](https://github.com/hover2pi)
- Sara Ogaz (DMD) [@SaOgaz](https://github.com/SaOgaz)
- Catherine Martlin (INS) [@catherine-martlin](https://github.com/catherine-martlin)
- Johannes Sahlmann (INS) [@Johannes-Sahlmann](https://github.com/johannes-sahlmann)
- Ben Sunnquist (INS) [@bsunnquist](https://github.com/bsunnquist)


## Acknowledgments:
- Faith Abney (DMD)
Expand Down Expand Up @@ -194,7 +202,6 @@ Any questions about the `jwql` project or its software can be directed to `jwql@
- Prem Mishra (ITSD)
- Don Mueller (ITSD)
- Maria Antonia Nieto-Santisteban (SEITO)
- Sara Ogaz (DMD) [@SaOgaz](https://github.com/SaOgaz)
- Brian O'Sullivan (INS)
- Joe Pollizzi (JWSTMO)
- Lee Quick (DMD)
Expand Down
40 changes: 40 additions & 0 deletions jwql/utils/anomaly_query_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""Globally defined and used variables for the JWQL query anomaly
feature. Variables will be re-defined when anomaly query forms are
submitted.
Authors
-------
- Teagan King
Use
---
This variables within this module are intended to be directly
imported, e.g.:
::
from jwql.utils.query_config import CHOSEN_INSTRUMENTS
"""

# Apertures selected by user in query_anomaly_2
APERTURES_CHOSEN = ["No apertures selected"]

# Anomalies available to select after instruments are selected in query_anomaly
# Default is all anomalies common to all instruments
CURRENT_ANOMALIES = ['cosmic_ray_shower', 'diffraction_spike', 'excessive_saturation',
'guidestar_failure', 'persistence', 'other']

# Instruments selected by user in query_anomaly
INSTRUMENTS_CHOSEN = ["No instruments selected"]

print("INSTRUMENTS_CHOSEN", INSTRUMENTS_CHOSEN)

# Observing modes selected by user
OBSERVING_MODES_CHOSEN = ["No observing modes selected"]

# Anomalies selected by user in query_anomaly_3
ANOMALIES_CHOSEN_FROM_CURRENT_ANOMALIES = ["No anomalies selected"]

# Filters selected by user in query_anomaly_2
FILTERS_CHOSEN = ["No filters selected"]
26 changes: 26 additions & 0 deletions jwql/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
-------
- Johannes Sahlmann
- Matthew Bourque
- Bryan Hilbert
- Ben Sunnquist
- Teagan King
Use
---
Expand Down Expand Up @@ -47,6 +51,7 @@
'3': [(2, 1032, 4), (0, 1024, 1)],
'4': [(3, 1032, 4), (0, 1024, 1)]}}

# Dictionary describing instruments to which anomalies apply
ANOMALIES_PER_INSTRUMENT = {
# anomalies affecting all instruments:
'cosmic_ray_shower': ['fgs', 'miri', 'nircam', 'niriss', 'nirspec'],
Expand Down Expand Up @@ -92,6 +97,17 @@
'nirspec': ['NRS_AUTOFLAT', 'NRS_LAMP'],
'fgs': ['FGS_INTFLAT']}

FILTERS_PER_INSTRUMENT = {'miri': ['F560W', 'F770W', 'F1000W', 'F1065C', 'F1130W', 'F1140C', 'F1280W',
'F1500W', 'F1550C', 'F1800W', 'F2100W', 'F2300C', 'F2550W'],
'nircam': ['F070W', 'F090W', 'F115W', 'F140M', 'F150W', 'F150W2', 'F162M',
'F164N', 'F182M', 'F187N', 'F200W', 'F210M', 'F212N', 'F250M',
'F277W', 'F300M', 'F322W2', 'F323N', 'F335M', 'F356W', 'F360M',
'F405N', 'F410M', 'F430M', 'F444W', 'F460M', 'F466N', 'F470N',
'F480M'],
'niriss': ['F090W', 'F115W', 'F140M', 'F150W', 'F185M', 'F200W', 'F227W',
'F356W', 'F380M', 'F430M', 'F444W', 'F480M'],
'nirspec': ['CLEAR', 'F070LP', 'F100LP', 'F170LP', 'F290LP']}

FOUR_AMP_SUBARRAYS = ['WFSS128R', 'WFSS64R', 'WFSS128C', 'WFSS64C']

# Names of full-frame apertures for all instruments
Expand All @@ -111,6 +127,7 @@
# Possible suffix types for guider exposures
GUIDER_SUFFIX_TYPES = ['stream', 'stacked_uncal', 'image_uncal', 'stacked_cal', 'image_cal']

# Instrument monitor database tables
INSTRUMENT_MONITOR_DATABASE_TABLES = {
'dark_monitor': ['<instrument>_dark_dark_current', '<instrument>_dark_pixel_stats', '<instrument>_dark_query_history'],
'bad_pixel_monitor': ['<instrument>_bad_pixel_stats', '<instrument>_bad_pixel_query_history']}
Expand Down Expand Up @@ -193,6 +210,15 @@
# Possible suffix types for AMI files
NIRISS_AMI_SUFFIX_TYPES = ['amiavg', 'aminorm', 'ami']

# Dictionary of observing modes available for each instrument
OBSERVING_MODE_PER_INSTRUMENT = {'miri': ['Imaging', '4QPM Coronagraphic Imaging',
'Lyot Coronagraphic Imaging', 'LRS', 'MRS'],
'nircam': ['Imaging', 'Coronagraphic Imaging', 'WFSS',
'Time-Series Imaging', 'Grism Time Series'],
'niriss': ['WFSS', 'SOSS', 'AMI', 'Imaging'],
'nirspec': ['Multi-Object Spectroscopy', 'IFU Spectroscopy',
'Fixed Slit Spectroscopy', 'Bright Object Time Series']}

SUBARRAYS_ONE_OR_FOUR_AMPS = ['SUBGRISMSTRIPE64', 'SUBGRISMSTRIPE128', 'SUBGRISMSTRIPE256']

# Possible suffix types for time-series exposures
Expand Down
4 changes: 2 additions & 2 deletions jwql/website/apps/jwql/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
-------
- Matthew Bourque
- Teagan King
Use
---
Expand Down Expand Up @@ -56,7 +57,6 @@
from .data_containers import get_thumbnails_by_instrument
from .data_containers import get_thumbnails_by_proposal
from .data_containers import get_thumbnails_by_rootname
from .oauth import auth_required


def all_proposals(request):
Expand Down Expand Up @@ -216,7 +216,7 @@ def thumbnails_by_instrument(request, inst):
Incoming request from the webpage
inst : str
The instrument of interest. The name of the instrument must
mach one of the following: (``nircam``, ``NIRCam``, ``niriss``,
match one of the following: (``nircam``, ``NIRCam``, ``niriss``,
``NIRISS``, ``nirspec``, ``NIRSpec``, ``miri``, ``MIRI``,
``fgs``, ``FGS``).
Expand Down
51 changes: 48 additions & 3 deletions jwql/website/apps/jwql/data_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Lauren Chambers
- Matthew Bourque
- Teagan King
Use
---
Expand Down Expand Up @@ -485,7 +486,8 @@ def get_filenames_by_rootname(rootname):
Parameters
----------
rootname : str
The rootname of interest (e.g. ``jw86600008001_02101_00007_guider2``).
The rootname of interest (e.g.
``jw86600008001_02101_00007_guider2``).
Returns
-------
Expand Down Expand Up @@ -725,7 +727,8 @@ def get_preview_images_by_rootname(rootname):
Parameters
----------
rootname : str
The rootname of interest (e.g. ``jw86600008001_02101_00007_guider2``).
The rootname of interest (e.g.
``jw86600008001_02101_00007_guider2``).
Returns
-------
Expand Down Expand Up @@ -792,7 +795,48 @@ def get_proposal_info(filepaths):

return proposal_info


def get_thumbnails_all_instruments(instruments):
"""Return a list of thumbnails available in the filesystem for all
instruments given requested parameters.
Returns
-------
thumbnails : list
A list of thumbnails available in the filesystem for the
given instrument.
"""

# Make sure instruments are of the proper format (e.g. "Nircam")
thumbnail_list = []
for inst in instruments: # JWST_INSTRUMENT_NAMES:
instrument = inst[0].upper()+inst[1:].lower()

### adjust query based on request

# Query MAST for all rootnames for the instrument
service = "Mast.Jwst.Filtered.{}".format(instrument)
params = {"columns": "filename, expstart, filter, readpatt, date_beg, date_end, apername, exp_type",
"filters": [{"paramName": "expstart",
"values": [{"min": 57404.04, "max": 57404.07}], }]}
response = Mast.service_request_async(service, params)
results = response[0].json()['data']

# Parse the results to get the rootnames
filenames = [result['filename'].split('.')[0] for result in results]

# Get list of all thumbnails
thumbnails = glob.glob(os.path.join(THUMBNAIL_FILESYSTEM, '*', '*.thumb'))

thumbnail_list.extend(thumbnails)

# Get subset of preview images that match the filenames
thumbnails = [os.path.basename(item) for item in thumbnail_list if
os.path.basename(item).split('_integ')[0] in filenames]

return thumbnails


def get_jwqldb_table_view_components(request):
"""Renders view for JWQLDB table viewer.
Expand Down Expand Up @@ -904,7 +948,8 @@ def get_thumbnails_by_rootname(rootname):
Parameters
----------
rootname : str
The rootname of interest (e.g. ``jw86600008001_02101_00007_guider2``).
The rootname of interest (e.g.
``jw86600008001_02101_00007_guider2``).
Returns
-------
Expand Down
Loading

0 comments on commit fac940b

Please sign in to comment.