Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
 def save(self, fname):
     save_object(self._photon_data, fname, compress=True)
Exemplo n.º 6
0
 def save(self,fname):
     save_object(self._photon_data,fname,compress=True)
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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)