Beispiel #1
0
from __future__ import print_function, division
import numpy as np, sys, os, errno
from enlib import utils
with utils.nowarn():
    import h5py
from enlib import config, pmat, mpi, errors, gapfill, enmap, bench, enplot
from enlib import fft, array_ops, scanutils
from enact import filedb, actscan, actdata, cuts, nmat_measure

try:
    xrange
except:
    xrange = range
opj = os.path.join

config.set("pmat_cut_type", "full")

parser = config.ArgumentParser(os.environ["HOME"] + "./enkirc")
parser.add_argument("planet")
parser.add_argument("area")
parser.add_argument("sel")
parser.add_argument("odir")
parser.add_argument("tag", nargs="?")
parser.add_argument("-R", "--dist", type=float, default=0.2)
parser.add_argument("-e", "--equator", action="store_true")
parser.add_argument("--sim",
                    type=str,
                    default=None,
                    help="Passing a sel here sets up simulation mode. "
                    "The simulations will consist of data from the sim "
                    "sel TODs with the scanning pattern of the real TODs, "
Beispiel #2
0
# Use joneig filtering to clean the area around each point source position.
# Treat the remainder as white noise. Make thumbnail maps in horizontal coordinates
# centered on the fiducial source position. Output as fully self-contained hdf files
# that can be analyzed by the fitter program.
import numpy as np, os, time, h5py, warnings
from astropy.io import fits
from enlib import utils, config, mpi, errors, sampcut, gapfill, cg
from enlib import pmat, coordinates, enmap, bench, bunch
from enact import filedb, actdata, actscan, nmat_measure
config.default("pmat_accuracy", 20.0, "Factor by which to lower accuracy requirement in pointing interpolation. 1.0 corresponds to 1e-3 pixels and 0.1 arc minute in polangle")
config.default("pmat_interpol_max_size", 1000000, "Maximum mesh size in pointing interpolation. Worst-case time and memory scale at most proportionally with this.")
config.default("gapfill", "linear", "TOD gapfill method. Can be 'copy', 'linear' or 'cubic'")
config.set("pmat_cut_type", "full", "Controls the degrees of freedom for the cut pmat. Using 'full' is stronly adviced to avoid unreasonable slowdown for src_thumb_build2")
parser = config.ArgumentParser(os.environ["HOME"] + "./enkirc")
parser.add_argument("srclist")
parser.add_argument("sel")
parser.add_argument("odir")
parser.add_argument("-A", "--minamp",    type=float, default=0)
parser.add_argument("-b", "--box",       type=str,   default="-10:10,-10:10")
parser.add_argument("-p", "--pad",       type=float, default=2)
parser.add_argument("-r", "--res",       type=float, default=0.1)
parser.add_argument("-s", "--restrict",  type=str,   default=None)
parser.add_argument("-m", "--minimaps",  action="store_true")
parser.add_argument("-c", "--cont",      action="store_true")
parser.add_argument("-C", "--cols",      type=str, default="0:1:2")
parser.add_argument(      "--nref",      type=int, default=2)
args = parser.parse_args()

# The joneig approach requires the mask to be as small as possible, especially in the scan
# direction, but the source must be entirely contained inside it. Previous tests have shown
# that x position can vary between -2' to 2'. If we want 3 sigma margin, then we need to add
Beispiel #3
0
import numpy as np, sys, os, ephem
from enlib import utils
with utils.nowarn():
    import h5py
from enlib import config, pmat, mpi, errors, gapfill, enmap, bench, ephemeris
from enlib import fft, array_ops, sampcut, cg
from enact import filedb, actscan, actdata, cuts, nmat_measure
from astropy.io import fits
config.set("pmat_cut_type", "full")
parser = config.ArgumentParser()
parser.add_argument("sel")
parser.add_argument("srcs")
parser.add_argument("area")
parser.add_argument("odir")
parser.add_argument("tag", nargs="?")
parser.add_argument("-R", "--dist", type=float, default=4)
parser.add_argument("-y", "--ypad", type=float, default=3)
parser.add_argument("-s",
                    "--src",
                    type=int,
                    default=None,
                    help="Only analyze given source")
parser.add_argument("-m", "--model", type=str, default="constrained")
parser.add_argument("-o", "--output", type=str, default="individual")
parser.add_argument("--hit-tol", type=float, default=0.5)
parser.add_argument("-c", "--cont", action="store_true")
args = parser.parse_args()

comm = mpi.COMM_WORLD
filedb.init()
R = args.dist * utils.arcmin
Beispiel #4
0
import numpy as np, sys, os, ephem
from enlib import utils
with utils.nowarn(): import h5py
from enlib import config, pmat, mpi, errors, gapfill, enmap, bench, ephemeris
from enlib import fft, array_ops, sampcut, cg
from enact import filedb, actscan, actdata, cuts, nmat_measure
config.set("pmat_cut_type",  "full")
parser = config.ArgumentParser()
parser.add_argument("sel")
parser.add_argument("srcs")
parser.add_argument("area")
parser.add_argument("odir")
parser.add_argument("tag", nargs="?")
parser.add_argument("-R", "--dist", type=float, default=4)
parser.add_argument("-y", "--ypad", type=float, default=3)
parser.add_argument("-s", "--src",  type=int,   default=None, help="Only analyze given source")
parser.add_argument("-c", "--cont", action="store_true")
parser.add_argument("-m", "--model",type=str, default="constrained")
parser.add_argument("--hit-tol",    type=float, default=0.5)
args = parser.parse_args()

comm = mpi.COMM_WORLD
filedb.init()
R    = args.dist * utils.arcmin
ypad = args.ypad * utils.arcmin
csize= 100
config.set("pmat_ptsrc_cell_res", 2*(R+ypad)/utils.arcmin)
config.set("pmat_ptsrc_rsigma", 5)
config.set("pmat_interpol_pad", 5+ypad/utils.arcmin)

dtype = np.float32
Beispiel #5
0
# which it shouldn't considering that they share data. And I trust the tod-level one more.
# However, this takes 1-5 s per likelihood evaluation. A robust fit requires ~500 evaluations,
# which would be 8-42 minutes. And that's using 16 cores! That's too slow. So this one is
# useful for comparing with a faster methods for a few reference tods, but not in general.
# Currently N and P take similar time. Can optimize P more with some effort, but N is dominated
# by ffts, and can't improve much.
from __future__ import division, print_function
import numpy as np, time, astropy.io.fits, os, sys
from scipy import optimize, integrate
from enlib import utils
with utils.nowarn(): import h5py
from enlib import mpi, errors, fft, mapmaking, config, jointmap, pointsrcs
from enlib import pmat, coordinates, enmap, bench, bunch, nmat, sampcut, gapfill, wcsutils, array_ops
from enact import filedb, actdata, actscan, nmat_measure

config.set("downsample", 1, "Amount to downsample tod by")
config.set("gapfill", "linear", "Gapfiller to use. Can be 'linear' or 'joneig'")
config.default("pmat_interpol_pad", 10.0, "Number of arcminutes to pad the interpolation coordinate system by")
config.default("pmat_interpol_max_size", 4000000, "Maximum mesh size in pointing interpolation. Worst-case time and memory scale at most proportionally with this.")

parser = config.ArgumentParser(os.environ["HOME"] + "./enkirc")
parser.add_argument("mode", help="Mode to use. Can be srcs or planet. This sets up useful defaults for other arguments")
parser.add_argument("srcdb_or_planet")
parser.add_argument("sel")
parser.add_argument("odir")
parser.add_argument("-R", "--radius",    type=float, default=12)
parser.add_argument("-r", "--res",       type=float, default=0.1)
parser.add_argument("-m", "--method",    type=str,   default="fixamp")
parser.add_argument("-M", "--minimaps",  action="store_true")
parser.add_argument("-c", "--cont",      action="store_true")
parser.add_argument("-s", "--srcs",      type=str,   default=None)
Beispiel #6
0
import numpy as np, sys, os
from enlib import utils
with utils.nowarn(): import h5py
from enlib import config, pmat, mpi, errors, gapfill, enmap, bench
from enlib import fft, array_ops
from enact import filedb, actscan, actdata, cuts, nmat_measure

config.set("pmat_cut_type",  "full")

parser = config.ArgumentParser(os.environ["HOME"]+"./enkirc")
parser.add_argument("planet")
parser.add_argument("area")
parser.add_argument("sel")
parser.add_argument("odir")
parser.add_argument("tag", nargs="?")
parser.add_argument("-R", "--dist",    type=float, default=0.2)
parser.add_argument("-e", "--equator", action="store_true")
parser.add_argument("-c", "--cont",    action="store_true")
parser.add_argument("--sim",           type=str,   default=None, help="Passing a sel here sets up simulation mode. The simulations will consist of data from the sim sel TODs with the scanning pattern of the real TODs, and with the signal read off from the area map")
parser.add_argument("--noiseless",      action="store_true", help="Replace signal with simulation instead of adding them. This can be used to get noise free transfer functions")
parser.add_argument("--dbox",          type=str,   default=None, help="Select only detectors in y1:y2,x1:x2 in the focalplane, relative to the center of the array, in degrees.")
args = parser.parse_args()

comm = mpi.COMM_WORLD
filedb.init()
ids  = filedb.scans[args.sel]
R    = args.dist * utils.degree
csize= 100

dtype= np.float32
area = enmap.read_map(args.area).astype(dtype)
Beispiel #7
0
# which it shouldn't considering that they share data. And I trust the tod-level one more.
# However, this takes 1-5 s per likelihood evaluation. A robust fit requires ~500 evaluations,
# which would be 8-42 minutes. And that's using 16 cores! That's too slow. So this one is
# useful for comparing with a faster methods for a few reference tods, but not in general.
# Currently N and P take similar time. Can optimize P more with some effort, but N is dominated
# by ffts, and can't improve much.
from __future__ import division, print_function
import numpy as np, time, astropy.io.fits, os, sys
from scipy import optimize
from enlib import utils
with utils.nowarn(): import h5py
from enlib import mpi, errors, fft, mapmaking, config, jointmap, pointsrcs
from enlib import pmat, coordinates, enmap, bench, bunch, nmat, sampcut, gapfill, wcsutils
from enact import filedb, actdata, actscan, nmat_measure

config.set("downsample", 1, "Amount to downsample tod by")
config.set("gapfill", "linear", "Gapfiller to use. Can be 'linear' or 'joneig'")
config.default("pmat_interpol_pad", 10.0, "Number of arcminutes to pad the interpolation coordinate system by")
config.default("pmat_interpol_max_size", 4000000, "Maximum mesh size in pointing interpolation. Worst-case time and memory scale at most proportionally with this.")

parser = config.ArgumentParser(os.environ["HOME"] + "./enkirc")
parser.add_argument("mode", help="Mode to use. Can be srcs or planet. This sets up useful defaults for other arguments")
parser.add_argument("srcdb_or_planet")
parser.add_argument("sel")
parser.add_argument("odir")
parser.add_argument("-R", "--radius",    type=float, default=12)
parser.add_argument("-r", "--res",       type=float, default=0.1)
parser.add_argument("-m", "--method",    type=str,   default="fixamp")
parser.add_argument("-M", "--minimaps",  action="store_true")
parser.add_argument("-c", "--cont",      action="store_true")
parser.add_argument("-s", "--srcs",      type=str,   default=None)
Beispiel #8
0
# Use joneig filtering to clean the area around each point source position.
# Treat the remainder as white noise. Make thumbnail maps in horizontal coordinates
# centered on the fiducial source position. Output as fully self-contained hdf files
# that can be analyzed by the fitter program.
import numpy as np, os, time, h5py, warnings
from astropy.io import fits
from enlib import utils, config, mpi, errors, sampcut, gapfill, cg
from enlib import pmat, coordinates, enmap, bench, bunch
from enact import filedb, actdata, actscan, nmat_measure
config.default("pmat_accuracy", 20.0, "Factor by which to lower accuracy requirement in pointing interpolation. 1.0 corresponds to 1e-3 pixels and 0.1 arc minute in polangle")
config.default("pmat_interpol_max_size", 1000000, "Maximum mesh size in pointing interpolation. Worst-case time and memory scale at most proportionally with this.")
config.default("gapfill", "linear", "TOD gapfill method. Can be 'copy', 'linear' or 'cubic'")
config.set("pmat_cut_type", "full", "Controls the degrees of freedom for the cut pmat. Using 'full' is stronly adviced to avoid unreasonable slowdown for src_thumb_build2")
parser = config.ArgumentParser(os.environ["HOME"] + "./enkirc")
parser.add_argument("srclist")
parser.add_argument("sel")
parser.add_argument("odir")
parser.add_argument("-A", "--minamp",    type=float, default=0)
parser.add_argument("-b", "--box",       type=str,   default="-10:10,-10:10")
parser.add_argument("-p", "--pad",       type=float, default=2)
parser.add_argument("-r", "--res",       type=float, default=0.1)
parser.add_argument("-s", "--restrict",  type=str,   default=None)
parser.add_argument("-m", "--minimaps",  action="store_true")
parser.add_argument("-c", "--cont",      action="store_true")
parser.add_argument("-C", "--cols",      type=str, default="0:1:2")
parser.add_argument(      "--nref",      type=int, default=2)
args = parser.parse_args()

# The joneig approach requires the mask to be as small as possible, especially in the scan
# direction, but the source must be entirely contained inside it. Previous tests have shown
# that x position can vary between -2' to 2'. If we want 3 sigma margin, then we need to add