def main(args): t = time.perf_counter() if args.drpcomplete is not None: # Use the DRPcomplete file root_dir = os.path.dirname(args.drpcomplete) if len(root_dir) == 0: root_dir = '.' drpver = args.drpcomplete[args.drpcomplete.find('_v') + 1:args.drpcomplete.find('.fits')] drpc = DRPComplete(drpver=drpver, directory_path=root_dir, readonly=True) index = drpc.entry_index(args.plate, args.ifudesign) MaNGADataCube.write_config(args.ofile, drpc['PLATE'][index], drpc['IFUDESIGN'][index], log=True, z=drpc['VEL'][index] / astropy.constants.c.to('km/s').value, vdisp=drpc['VDISP'][index], ell=drpc['ELL'][index], pa=drpc['PA'][index], reff=drpc['REFF'][index], sres_ext=args.sres_ext, sres_fill=args.sres_fill, covar_ext=args.covar_ext, drpver=args.drpver, redux_path=args.redux_path, overwrite=args.overwrite) return # Use the DRPall file with fits.open(args.drpall) as hdu: indx = numpy.where(hdu['MANGA'].data['PLATEIFU'] == '{0}-{1}'.format( args.plate, args.ifudesign))[0] if len(indx) != 1: raise ValueError( '{0}-{1} either does not exist or has more than one match!'. format(args.plate, args.ifudesign)) MaNGADataCube.write_config( args.ofile, args.plate, args.ifudesign, z=hdu[1].data['z'][indx[0]], ell=1 - hdu[1].data['nsa_elpetro_ba'][indx[0]], pa=hdu[1].data['nsa_elpetro_phi'][indx[0]], reff=hdu[1].data['nsa_elpetro_th50_r'][indx[0]], sres_ext=args.sres_ext, sres_fill=args.sres_fill, covar_ext=args.covar_ext, drpver=args.drpver, redux_path=args.redux_path, directory_path=args.directory_path, overwrite=args.overwrite) print('Elapsed time: {0} seconds'.format(time.perf_counter() - t))
def get_config(plt, ifu, config_file, drpall_file=None): if drpall_file is None: drpall_file = manga.drpall_file() # Use the DRPall file with fits.open(drpall_file) as hdu: indx = numpy.where( hdu['MANGA'].data['PLATEIFU'] == '{0}-{1}'.format(plt, ifu))[0] if len(indx) != 1: raise ValueError( '{0}-{1} either does not exist or has more than one match!'. format(plt, ifu)) MaNGADataCube.write_config( config_file, plt, ifu, z=hdu[1].data['z'][indx[0]], ell=1 - hdu[1].data['nsa_elpetro_ba'][indx[0]], pa=hdu[1].data['nsa_elpetro_phi'][indx[0]], reff=hdu[1].data['nsa_elpetro_th50_r'][indx[0]], overwrite=True)