def __init__(self, sciImg, spectrograph, par, caliBrate, **kwargs): super(EchelleReduce, self).__init__(sciImg, spectrograph, par, caliBrate, **kwargs) # JFH For 2d coadds the orders are no longer located at the standard locations if 'coadd2d' in self.objtype: self.order_vec = spectrograph.orders else: slit_spat_pos = edgetrace.slit_spat_pos(self.tslits_dict) self.order_vec = self.spectrograph.order_vec(slit_spat_pos)
def __init__(self, tslits_dict, tilts, wv_calib, spectrograph, det, maskslits, master_key=None, master_dir=None, reuse_masters=False): # MasterFrame masterframe.MasterFrame.__init__(self, self.master_type, master_dir=master_dir, master_key=master_key, reuse_masters=reuse_masters) # Required parameters self.spectrograph = spectrograph self.det = det self.tslits_dict = tslits_dict self.tilts = tilts self.wv_calib = wv_calib if tslits_dict is not None: self.slitmask = pixels.tslits2mask(self.tslits_dict) self.slit_spat_pos = edgetrace.slit_spat_pos(self.tslits_dict) else: self.slitmask = None self.slit_spat_pos = None self.maskslits = maskslits # For echelle order, primarily # TODO: only echelle is ever used. Do we need to keep the whole # thing? self.par = wv_calib['par'] if wv_calib is not None else None # Main output self.image = None self.steps = []
def __init__(self, msarc, tslits_dict, spectrograph, par, binspectral=None, det=1, master_key=None, master_dir=None, reuse_masters=False, qa_path=None, msbpm=None): # MasterFrame masterframe.MasterFrame.__init__(self, self.master_type, master_dir=master_dir, master_key=master_key, file_format='json', reuse_masters=reuse_masters) # Required parameters (but can be None) self.msarc = msarc self.tslits_dict = tslits_dict self.spectrograph = spectrograph self.par = par # Optional parameters self.bpm = msbpm self.binspectral = binspectral self.qa_path = qa_path self.det = det self.master_key = master_key # Attributes self.steps = [] # steps executed self.wv_calib = {} # main output self.arccen = None # central arc spectrum # Get the non-linear count level self.nonlinear_counts = 1e10 if self.spectrograph is None \ else self.spectrograph.nonlinear_counts(self.det) # -------------------------------------------------------------- # TODO: Build another base class that does these things for both # WaveTilts and WaveCalib? # Set the slitmask and slit boundary related attributes that the # code needs for execution. This also deals with arcimages that # have a different binning then the trace images used to defined # the slits if self.tslits_dict is not None and self.msarc is not None: self.slitmask_science = pixels.tslits2mask(self.tslits_dict) gpm = self.bpm == 0 if self.bpm is not None \ else np.ones_like(self.slitmask_science, dtype=bool) self.shape_science = self.slitmask_science.shape self.shape_arc = self.msarc.image.shape self.nslits = self.tslits_dict['slit_left'].shape[1] self.slit_left = arc.resize_slits2arc( self.shape_arc, self.shape_science, self.tslits_dict['slit_left']) self.slit_righ = arc.resize_slits2arc( self.shape_arc, self.shape_science, self.tslits_dict['slit_righ']) self.slitcen = arc.resize_slits2arc(self.shape_arc, self.shape_science, self.tslits_dict['slitcen']) self.slitmask = arc.resize_mask2arc(self.shape_arc, self.slitmask_science) self.gpm = arc.resize_mask2arc(self.shape_arc, gpm) # We want even the saturated lines in full_template for the cross-correlation # They will be excised in the detect_lines() method on the extracted arc if self.par['method'] != 'full_template': self.gpm &= self.msarc.image < self.nonlinear_counts self.slit_spat_pos = edgetrace.slit_spat_pos( self.tslits_dict['slit_left'], self.tslits_dict['slit_righ'], self.tslits_dict['nspec'], self.tslits_dict['nspat']) else: self.slitmask_science = None self.shape_science = None self.shape_arc = None self.nslits = 0 self.slit_left = None self.slit_righ = None self.slitcen = None self.slitmask = None self.gpm = None self.nonlinear_counts = None
def __init__(self, msalign, tslits_dict, spectrograph, par, det=1, binning=None, qa_path=None, msbpm=None): # MasterFrame #masterframe.MasterFrame.__init__(self, self.master_type, master_dir=master_dir, # master_key=master_key, file_format='fits', # reuse_masters=reuse_masters) # Required parameters (but can be None) self.msalign = msalign self.tslits_dict = tslits_dict self.spectrograph = spectrograph self.par = par self.binning = binning # Optional parameters self.bpm = msalign.mask if msbpm is None else msbpm self.qa_path = qa_path self.det = det #self.master_key = master_key # Attributes self.viewer, self.channel = None, None self.steps = [] # steps executed # Get the non-linear count level self.nonlinear_counts = 1e10 if self.spectrograph is None \ else self.spectrograph.nonlinear_counts(self.det) # -------------------------------------------------------------- # Set the slitmask and slit boundary related attributes that the # code needs for execution. This also deals with alignframes that # have a different binning then the images used to defined # the slits if self.tslits_dict is not None and self.msalign is not None: self.slitmask_science = pixels.tslits2mask(self.tslits_dict) gpm = self.bpm == 0 if self.bpm is not None \ else np.ones_like(self.slitmask_science, dtype=bool) self.shape_science = self.slitmask_science.shape self.shape_align = self.msalign.image.shape self.nslits = self.tslits_dict['slit_left'].shape[1] self.slit_left = arc.resize_slits2arc( self.shape_align, self.shape_science, self.tslits_dict['slit_left']) self.slit_righ = arc.resize_slits2arc( self.shape_align, self.shape_science, self.tslits_dict['slit_righ']) self.slitcen = arc.resize_slits2arc(self.shape_align, self.shape_science, self.tslits_dict['slitcen']) self.slitmask = arc.resize_mask2arc(self.shape_align, self.slitmask_science) self.gpm = arc.resize_mask2arc(self.shape_align, gpm) self.gpm &= self.msalign.image < self.nonlinear_counts self.slit_spat_pos = edgetrace.slit_spat_pos( self.tslits_dict['slit_left'], self.tslits_dict['slit_righ'], self.tslits_dict['nspec'], self.tslits_dict['nspat']) else: self.slitmask_science = None self.shape_science = None self.shape_align = None self.nslits = 0 self.slit_left = None self.slit_righ = None self.slitcen = None self.slitmask = None self.gpm = None self.nonlinear_counts = None