def save(self,outfile,format='pickle'): if format == 'pickle': save_object(self,outfile,compress=True) elif format == 'yaml': self.save_to_yaml(outfile) else: print 'Unrecognized output format: ', format sys.exit(1)
def save(self, outfile, format='pickle'): if format == 'pickle': save_object(self, outfile, compress=True) elif format == 'yaml': self.save_to_yaml(outfile) else: print 'Unrecognized output format: ', format sys.exit(1)
usage = "usage: %(prog)s [options] [catalog FITS file]" description = "Load a FITS catalog and write to an output file." parser = argparse.ArgumentParser(usage=usage,description=description) parser.add_argument('files', nargs='+') parser.add_argument('--output', default = None, help = 'Output file') parser.add_argument('--source', default = None, help = 'Output file') parser.add_argument('--roi_radius', default = 10., type=float, help = 'Output file') args = parser.parse_args() if len(args.files) == 1: cat = Catalog.create_from_fits(args.files[0]) else: cat = Catalog() # if not opts.source is None: # src = CatalogSource(cat.get_source_by_name(opts.source)) if not args.output is None: if re.search('\.P$',args.output): save_object(cat,args.output,compress=True)
o[name] = flux_sum energy_index = np.arange(0,24) #energy_index = [6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24] #energy_index = [10,12,14,16] domega = hp.pixelfunc.nside2pixarea(ccube_hp.nside) ccube_smooth_hp = ccube_hp.smooth(args.rsmooth) flux_smooth_hp = ccube_smooth_hp/bexpcube_hp flux_smooth_hp /= domega*deltae[:,np.newaxis] o['flux_allsky'] = flux_smooth_hp save_object(o,'%sflux_healpix.P'%(args.prefix),compress=True) sys.exit(0) for index in energy_index: continue title = 'log$_{10}$(E/MeV) = [%.3f, %.3f]'%(eaxis.edges[index], eaxis.edges[index+1]) index2 = ccube_hp.axis(0).valToBin(eaxis.center[index]) ecenter = eaxis.center[index] deltae = 10**eaxis.edges[index+1] - 10**eaxis.edges[index] # Get pixel area domega = hp.pixelfunc.nside2pixarea(ccube_hp.nside)
def save(self, fname): save_object(self._photon_data, fname, compress=True)
def save(self,fname): save_object(self._photon_data,fname,compress=True)
o[name] = flux_sum energy_index = np.arange(0, 24) #energy_index = [6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,24] #energy_index = [10,12,14,16] domega = hp.pixelfunc.nside2pixarea(ccube_hp.nside) ccube_smooth_hp = ccube_hp.smooth(args.rsmooth) flux_smooth_hp = ccube_smooth_hp / bexpcube_hp flux_smooth_hp /= domega * deltae[:, np.newaxis] o['flux_allsky'] = flux_smooth_hp save_object(o, '%sflux_healpix.P' % (args.prefix), compress=True) sys.exit(0) for index in energy_index: continue title = 'log$_{10}$(E/MeV) = [%.3f, %.3f]' % (eaxis.edges[index], eaxis.edges[index + 1]) index2 = ccube_hp.axis(0).valToBin(eaxis.center[index]) ecenter = eaxis.center[index] deltae = 10**eaxis.edges[index + 1] - 10**eaxis.edges[index] # Get pixel area domega = hp.pixelfunc.nside2pixarea(ccube_hp.nside)
usage = "usage: %(prog)s [options] [catalog FITS file]" description = "Load a FITS catalog and write to an output file." parser = argparse.ArgumentParser(usage=usage, description=description) parser.add_argument('files', nargs='+') parser.add_argument('--output', default=None, help='Output file') parser.add_argument('--source', default=None, help='Output file') parser.add_argument('--roi_radius', default=10., type=float, help='Output file') args = parser.parse_args() if len(args.files) == 1: cat = Catalog.create_from_fits(args.files[0]) else: cat = Catalog() # if not opts.source is None: # src = CatalogSource(cat.get_source_by_name(opts.source)) if not args.output is None: if re.search('\.P$', args.output): save_object(cat, args.output, compress=True)