Example #1
0
import h5py
import numpy as np

from imaginglss import DECALS
from imaginglss.model import dataproduct

from imaginglss.cli import CLI

cli = CLI("Export Final Data Products",
          enable_target_plugins=True,
          enable_tycho_veto=True,
          enable_confidence=True)

cli.add_target_type_argument("ObjectType")
cli.add_argument("catalogue", help="internal catalogue of HDF5 type.")
cli.add_argument("output", help="text file to store the catalogue.")
cli.add_argument("--bands",
                 nargs='+',
                 type=str,
                 choices=dataproduct.bands.keys(),
                 default=['r', 'g', 'z'],
                 help="Bands to export in the text file")

ns = cli.parse_args()
decals = DECALS(ns.conf)

confcut = {
    'z': ns.sigma_z,
    'r': ns.sigma_r,
    'g': ns.sigma_g,
}
Example #2
0
#
# Usage: python build_cache.py
#
from __future__ import print_function
from sys import stdout

__author__ = "Yu Feng and Martin White"
__version__ = "1.0"
__email__ = "[email protected] or [email protected]"

from imaginglss import DECALS
import numpy

from imaginglss.cli import CLI
from imaginglss.analysis import cache

ap = CLI("Build cache")

ns = ap.parse_args()

decals = DECALS(ns.conf)
print('building brick index')
dr = decals.datarelease

print('building tractor cache')
builder = cache.CacheBuilder(decals.sweep_dir, decals.cache_dir,
                             dr.schema.CATALOGUE_COLUMNS)

builder.build()
print('done')
import h5py
import numpy as np

from imaginglss import DECALS
from imaginglss.model import dataproduct

from imaginglss.cli import CLI

cli = CLI("Naive Angular Cross Correlation Function",
          enable_target_plugins=True,
          enable_tycho_veto=True,
          enable_confidence=True)
cli.add_argument("--np",
                 default=8,
                 type=int,
                 help="nubmer of in-node cores to use")
cli.add_argument("catalogue1", help="internal catalogue of HDF5 type.")
cli.add_argument("random1", help="internal catalogue of HDF5 type.")
cli.add_argument("catalogue2", help="internal catalogue of HDF5 type.")
cli.add_argument("output", help="text file to store the correlation function.")

from kdcount import sphere
from kdcount import correlate

ns = cli.parse_args()


def corr():
    data1file = h5py.File(ns.catalogue1, 'r')
    data2file = h5py.File(ns.catalogue2, 'r')
    rand1file = h5py.File(ns.random1, 'r')
__author__ = "Yu Feng and Martin White"
__version__ = "1.0"
__email__ = "[email protected] or [email protected]"

import h5py

from imaginglss import DECALS

from imaginglss.cli import CLI

cli = CLI("""
Query Depth from DECALS data for input RA DEC of points.
The input must be saved in a HDF5 with two datasets 'RA' and 'DEC'.
The output will be written in the same file as INTRINSIC_NOISELEVEL data set.
To lookup the columns, use the dictionary in `imaginglss.model.datcliroduct.bands`.

The output of this script can be directly fed into imglss-query-completeness.py
as the query input.

""")

cli.add_argument(
    "query",
    help=
    "An HDF5 file with RA and DEC dataset, the position of to query the depth."
)

ns = cli.parse_args()
decals = DECALS(ns.conf)

import numpy as np
Example #5
0
#
from __future__ import print_function

__author__ = "Yu Feng and Martin White"
__version__ = "1.0"
__email__ = "[email protected] or [email protected]"

import numpy as np
import h5py

from imaginglss import DECALS
from imaginglss.analysis import cuts
from imaginglss.model import dataproduct
from imaginglss.cli import CLI

cli = CLI("Select Objects based on Target definitions",
          enable_target_plugins=True)
cli.add_argument("--use-depth-bricks",
                 action='store_true',
                 default=False,
                 help="Use Tractor's Brick Depth in the catalogue, very slow!")
cli.add_target_type_argument("ObjectType")
cli.add_argument(
    "output",
    help="Output file name. A new object catalogue file will be created.")

ns = cli.parse_args()

decals = DECALS(ns.conf)

from mpi4py import MPI
Example #6
0
__email__ = "[email protected] or [email protected]"

import numpy as np
import h5py

from imaginglss import DECALS
from imaginglss.analysis import tycho_veto
from imaginglss.analysis import veto

from imaginglss.cli import CLI

cli = CLI("""
Query the TYCHOVETO flags of input data. The position is taken from the NOISES extension of input.
The result is written to the TYCHOVETO extension of output.

Currently, only veto by proximity to tycho stars are implemented. Each veto in
imaginglss.analysis.tycho_veto is calculated as a column in the TYCHOVETO extension.

Unfortunately, this script is not sufficiently smart to decide the correct TYCHOVETO for the target type.
Therefore, no combined veto flag is generated.
""")
cli.add_argument(
    "catalogue",
    help=
    "HDF5 catalogue file, can be either random or objects. TYCHO_VETO dataset will be added "
)

ns = cli.parse_args()
decals = DECALS(ns.conf)

np.seterr(divide='ignore', invalid='ignore')
Example #7
0
from __future__ import print_function
import numpy as np
import h5py

from imaginglss import DECALS
from imaginglss.model import dataproduct
from imaginglss.analysis import completeness
from imaginglss.utils import output

from imaginglss.cli import CLI

cli = CLI("Query completeness",
          enable_target_plugins=True,
          enable_confidence=True,
          enable_tycho_veto=True)

cli.add_target_type_argument("ObjectType")

cli.add_argument("objects",
                 help="object catalogue for building the completeness model.")
cli.add_argument("query", help="catalogue to query completeness")

ns = cli.parse_args()
decals = DECALS(ns.conf)

np.seterr(divide='ignore', invalid='ignore')


def query_completeness(decals, ns):
    with h5py.File(ns.objects, 'r') as ff:
        FLUX = ff['INTRINSIC_FLUX'][:]
Example #8
0
from __future__ import print_function
import numpy as np
import h5py

from imaginglss import DECALS
from imaginglss.model import dataproduct
from imaginglss.analysis import completeness
from imaginglss.utils import output
from imaginglss.model.ccdtable import CCDTable

from imaginglss.cli import CLI
from kdcount.sphere import points

cli = CLI("Query completeness",
          enable_target_plugins=True,
          enable_confidence=True,
          enable_tycho_veto=True)

cli.add_argument("query", help="catalogue to query ccd systematic")

cli.add_argument(
    "ccdfilepath",
    help="survey ccd fits file path; this is the path to the ccd fits file(s)."
)

cli.add_argument("ccdattrs",
                 type=lambda x: x.upper(),
                 nargs="+",
                 help="column name to query ")

ns = cli.parse_args()
# Then a query on this file would return randoms appropriate
# for whatever selection is desired.
#
from __future__ import print_function, division

__author__ = "Yu Feng and Martin White"
__version__ = "1.0"
__email__ = "[email protected] or [email protected]"

import h5py

from imaginglss import DECALS

from imaginglss.cli import CLI

cli = CLI("Generate Uniform Randoms in the footprint and query the depth.")
cli.add_argument(
    "--seed",
    type=int,
    help="random seed; the result is also affected by the number of ranks.",
    default=99934123)
cli.add_argument("Nran", type=int, help="Minimum number of randoms")
cli.add_argument("output", help="File to store the randoms. Will be created.")

ns = cli.parse_args()
decals = DECALS(ns.conf)

import numpy as np
from imaginglss.model.datarelease import Footprint
from imaginglss.model import dataproduct
from mpi4py import MPI