def coadd1d_filelist(files, outroot, det, debug=False, show=False): """ Args: files: outroot: det: debug: show: Returns: outfiles (list): list of files written to """ # Build sync_dict sync_dict = None for ifile in files[1:]: sync_dict = coadd.sync_pair(files[0], ifile, det, sync_dict=sync_dict) # header = fits.getheader(files[0]) spectrograph = load_spectrograph(header['PYP_SPEC']) par = spectrograph.default_pypeit_par() par['coadd1d']['flux_value'] = False sensfile = None outfiles = [] # Loop on entries for key in sync_dict: coaddfile = outroot + '-SPAT{:04d}-DET{:02d}'.format(key, det) + '.fits' coAdd1d = coadd1d.CoAdd1D.get_instance(sync_dict[key]['files'], sync_dict[key]['names'], spectrograph=spectrograph, par=par['coadd1d'], sensfile=sensfile, debug=debug, show=show) # Run coAdd1d.run() # Save to file coAdd1d.save(coaddfile) outfiles.append(coaddfile) return outfiles
def coadd1d_filelist(files, outroot, det, debug=False, show=False): """ Args: files: outroot: det (:obj:`str`): String identifier for the detector or mosaic with the 1D spectra to coadd. debug: show: Returns: :obj:`list`: List of output files written. """ # Build sync_dict sync_dict = None for ifile in files[1:]: sync_dict = coadd.sync_pair(files[0], ifile, det, sync_dict=sync_dict) # header = fits.getheader(files[0]) spectrograph = load_spectrograph(header['PYP_SPEC']) par = spectrograph.default_pypeit_par() par['coadd1d']['flux_value'] = False sensfile = None outfiles = [] # Loop on entries for key in sync_dict: coaddfile = outroot+f'-SPAT{key:04d}-{det}.fits' coAdd1d = coadd1d.CoAdd1D.get_instance(sync_dict[key]['files'], sync_dict[key]['names'], spectrograph=spectrograph, par=par['coadd1d'], sensfile=sensfile, debug=debug, show=show) # Run coAdd1d.run() # Save to file coAdd1d.save(coaddfile) outfiles.append(coaddfile) return outfiles