# download coinc.xml coinc_file = gracedb.files(graceid, "coinc.xml") # download psd.xml.gz psd_file = gracedb.files(graceid, "psd.xml.gz") if opts.chain_dump: chain_dump = opts.output.replace('.fits.gz', '').replace('.fits', '') + '.chain.npy' else: chain_dump = None # perform sky localization log.info("starting sky localization") sky_map, epoch, elapsed_time, instruments = gracedb_sky_map( coinc_file, psd_file, opts.waveform, opts.f_low, opts.min_distance, opts.max_distance, opts.prior_distance_power, phase_convention=opts.phase_convention, nside=opts.nside, f_high_truncate=opts.f_high_truncate, method=opts.method, chain_dump=chain_dump) prob, distmu, distsigma, _ = sky_map distmean, diststd = distance.parameters_to_marginal_moments( prob, distmu, distsigma) log.info("sky localization complete") # upload FITS file fitsdir = tempfile.mkdtemp() try: fitspath = os.path.join(fitsdir, opts.output) fits.write_sky_map(fitspath, sky_map, gps_time=float(epoch), creator=parser.prog, objid=str(graceid), url='https://gracedb.ligo.org/events/{0}'.format(graceid), runtime=elapsed_time, instruments=instruments,
# A little bit of Cylon humor log.info('by your command...') try: # download coinc.xml coinc_file = gracedb.files(graceid, "coinc.xml") # download psd.xml.gz psd_file = gracedb.files(graceid, "psd.xml.gz") # perform sky localization log.info("starting sky localization") sky_map = rasterize(gracedb_sky_map( coinc_file, psd_file, opts.waveform, opts.f_low, opts.min_distance, opts.max_distance, opts.prior_distance_power, nside=opts.nside, f_high_truncate=opts.f_high_truncate, method=opts.method, chain_dump=chain_dump, enable_snr_series=opts.enable_snr_series)) sky_map.meta['objid'] = str(graceid) sky_map.meta['url'] = 'https://gracedb.ligo.org/events/{0}'.format(graceid) log.info("sky localization complete") # upload FITS file with command.TemporaryDirectory() as fitsdir: fitspath = os.path.join(fitsdir, opts.output) fits.write_sky_map(fitspath, sky_map, nest=True) log.debug('wrote FITS file: %s', opts.output) if opts.dry_run: command.rename(fitspath, os.path.join('.', opts.output)) else: gracedb.writeLog(
try: # download coinc.xml coinc_file = gracedb.files(graceid, "coinc.xml") # download psd.xml.gz psd_file = gracedb.files(graceid, "psd.xml.gz") # perform sky localization log.info("starting sky localization") sky_map, epoch, elapsed_time, instruments = gracedb_sky_map( coinc_file, psd_file, opts.waveform, opts.f_low, opts.min_distance, opts.max_distance, opts.prior_distance_power, nside=opts.nside, f_high_truncate=opts.f_high_truncate, method=opts.method, chain_dump=chain_dump, enable_snr_series=opts.enable_snr_series) prob, distmu, distsigma, _ = sky_map distmean, diststd = distance.parameters_to_marginal_moments( prob, distmu, distsigma) log.info("sky localization complete") # upload FITS file with command.TemporaryDirectory() as fitsdir: fitspath = os.path.join(fitsdir, opts.output) fits.write_sky_map(