Ejemplo n.º 1
0
                          clobber=True)

        fitsio.write(outfile,
                     dict(DISTANCE_MODULUS=self.distance_modulus_array.astype(
                         'f4', copy=False)),
                     extname='DISTANCE_MODULUS',
                     clobber=False)


if __name__ == "__main__":
    import ugali.utils.parser
    description = "Script for executing the likelihood scan."
    parser = ugali.utils.parser.Parser(description=description)
    parser.add_config()
    parser.add_argument('outfile',
                        metavar='outfile.fits',
                        help='Output fits file.')
    parser.add_debug()
    parser.add_verbose()
    parser.add_coords(required=True, radius=False)
    opts = parser.parse_args()

    if len(opts.coords) != 1:
        raise Exception('Must specify exactly one coordinate.')
    lon, lat, radius = opts.coords[0]

    grid = createGridSearch(opts.config, lon, lat)
    if not opts.debug:
        result = grid.search()
        grid.write(opts.outfile)
Ejemplo n.º 2
0
                
        if outfile: ugali.utils.fileio.write(outfile,results,clobber=True)
            
        return results

if __name__ == "__main__":
    import ugali.utils.parser
    parser = ugali.utils.parser.Parser(description=__doc__)
    parser.add_config()
    parser.add_argument('-p','--popfile',default=None,
                        help='simulated population input file')
    parser.add_argument('-c','--catfile',default=None,
                        help='simulated catalog input file')
    parser.add_argument('-o','--outfile',default=None,
                        help='output results file')
    parser.add_argument('-i','--mc-source-id',default=None,type=int,action='append',
                        help='specific source id to run')
    parser.add_force()
    parser.add_debug()
    parser.add_verbose()
    args = parser.parse_args()

    analyzer = Analyzer(args.config,args.catfile,args.popfile)
    
    if args.mc_source_id is None:
        basename = os.path.splitext(args.catfile)[0]
        imin,imax = list(map(int,basename.rsplit('_',1)[-1].split('-')))
        args.mc_source_id = np.arange(imin,imax+1)

    analyzer.run(outfile=args.outfile,mc_source_id=args.mc_source_id)