def __init__(self, inp): """ Class to organize and execute QA for a DESI frame x.flavor, x.qa_data, x.camera Args: inp : Frame object or dict * Frame -- Must contain meta data * dict -- Usually read from hard-drive Notes: """ if isinstance(inp,dict): assert len(inp) == 1 self.night = list(inp.keys())[0] # Requires night in first key assert len(inp[self.night]) == 1 self.expid = list(inp[self.night].keys())[0] assert len(inp[self.night][self.expid]) == 2 self.flavor = inp[self.night][self.expid].pop('flavor') self.camera = list(inp[self.night][self.expid].keys())[0] assert self.camera[0] in ['b','r','z'] self.qa_data = inp[self.night][self.expid][self.camera] else: # Generate from Frame and init QA data qkeys = ['flavor', 'camera', 'expid', 'night'] for key in qkeys: setattr(self, key, inp.meta[key.upper()]) # FITS header self.qa_data = {} # Final test desi_params = read_params() assert self.flavor in desi_params['frame_types']
def load_meta(self, frame_meta): """ Load meta info from input Frame meta Args: frame_meta: """ desi_params = read_params() for key in desi_params['frame_meta']: if key in ['CAMERA']: # Frame specific continue self.meta[key] = frame_meta[key]
def load_meta(self, frame_meta): """ Load meta info from input Frame meta Args: frame_meta: """ desi_params = read_params() for key in desi_params['frame_meta']: if key in ['CAMERA']: # Frame specific continue try: self.meta[key] = frame_meta[key] except KeyError: print("Keyword {:s} not present! Could be a problem".format(key))
def __init__(self, expid, night, flavor, specprod_dir=None, in_data=None, **kwargs): """ Class to organize and execute QA for a DESI Exposure x.flavor, x.data Args: expid: int -- Exposure ID night: str -- YYYYMMDD flavor: str exposure type (e.g. flat, arc, science) specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. in_data: dict, optional -- Input data Mainly for reading from disk Notes: Attributes: All input args become object attributes. """ desi_params = read_params() assert flavor in desi_params[ 'frame_types'], "Unknown flavor {} for night {} expid {}".format( flavor, night, expid) if flavor in ['science']: self.type = 'data' else: self.type = 'calib' self.expid = expid self.night = night self.specprod_dir = specprod_dir self.flavor = flavor self.meta = {} if in_data is None: self.data = dict(flavor=self.flavor, expid=self.expid, night=self.night, frames={}) self.load_qa_data(**kwargs) else: assert isinstance(in_data, dict) self.data = in_data
from desiutil.log import get_logger from desispec import fluxcalibration as dsflux from desispec.util import set_backend set_backend() import matplotlib from matplotlib import pyplot as plt import matplotlib.gridspec as gridspec from desispec import util from desispec.io import makepath from desiutil import plots as desiu_p from desispec.io import read_params desi_params = read_params() def brick_zbest(outfil, zf, qabrick): """ QA plots for Flux calibration in a Frame Args: outfil: qabrick: zf: ZfindBase object Returns: Stuff? """ sty_otype = get_sty_otype() # Convert types (this should become obsolete)
""" Classes to organize and execute QA for a DESI exposure """ from __future__ import print_function, absolute_import, division import warnings import numpy as np import copy from desiutil.log import get_logger from desispec.io import read_params desi_params = read_params() # log=get_logger() class QA_Frame(object): def __init__(self, inp): """ Class to organize and execute QA for a DESI frame x.flavor, x.qa_data, x.camera Args: inp : Frame object or dict * Frame -- Must contain meta data * dict -- Usually read from hard-drive