Ejemplo n.º 1
0
Archivo: rebin.py Proyecto: rag9704/PTS
definition.add_flag("backup", "make backups", True)

# Parse the command line arguments
config = parse_arguments("rebin", definition)

# -----------------------------------------------------------------

# Load frame list
frames = NamedFrameList.from_directory(config.path, contains=config.contains)

# -----------------------------------------------------------------

# Rebin
if config.name is not None: frames.rebin_to_name(config.name)
elif config.wcs is not None:
    wcs = CoordinateSystem.from_file(config.wcs)
    frames.rebin_to_wcs(wcs)
else:
    frames.rebin_to_highest_pixelscale()

# -----------------------------------------------------------------

# Backup original files
if config.backup:
    fs.backup_files_in_directory(config.path,
                                 extension="fits",
                                 contains=config.contains)

# Save new frames
frames.write_to_directory(config.path, replace=True)
Ejemplo n.º 2
0
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

## \package pts.do.magic.sky_to_pix Convert a sky coordinate to a pixel coordinate for a specific WCS.

# -----------------------------------------------------------------

# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.basics.coordinatesystem import CoordinateSystem

# -----------------------------------------------------------------

definition = ConfigurationDefinition()

definition.add_required("coordinate", "skycoordinate", "the sky coordinate")
definition.add_required("wcs_path", "file_path", "the path to the file holding the WCS info")

# Get the configuration
config = parse_arguments("pix_to_sky", definition)

# -----------------------------------------------------------------

# Print the pixel coordinate
print(config.coordinate.to_pixel(CoordinateSystem.from_file(config.wcs_path)))

# -----------------------------------------------------------------
Ejemplo n.º 3
0
modeling_path = verify_modeling_cwd()

# -----------------------------------------------------------------

data_images_path = get_data_images_path(modeling_path)

# -----------------------------------------------------------------

pixelscales = dict()

# Loop over the images
for image_path, image_name in fs.files_in_path(data_images_path, extension="fits", not_contains="poisson", returns=["path", "name"], recursive=True, recursion_level=1):

    # Load the images
    wcs = CoordinateSystem.from_file(image_path)

    # Get pixelscale
    pixelscale = wcs.average_pixelscale

    # Get filter name
    header = get_header(image_path)
    fltr = headers.get_filter(image_name, header)
    filter_name = str(fltr)

    # Set pixelscale
    pixelscales[filter_name] = pixelscale

# -----------------------------------------------------------------

# Sort on pixelscale
Ejemplo n.º 4
0
## \package pts.do.magic.pix_to_sky Convert a pixel coordinate to a sky coordinate for a specific WCS.

# -----------------------------------------------------------------

# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.basics.coordinatesystem import CoordinateSystem

# -----------------------------------------------------------------

definition = ConfigurationDefinition()

definition.add_required("coordinate", "pixelcoordinate",
                        "the pixel coordinate")
definition.add_required("wcs_path", "file_path",
                        "the path to the file holding the WCS info")

# Get the configuration
config = parse_arguments("pix_to_sky", definition)

# -----------------------------------------------------------------

# Print the sky coordinate
print(config.coordinate.to_sky(CoordinateSystem.from_file(config.wcs_path)))

# -----------------------------------------------------------------
Ejemplo n.º 5
0
# -----------------------------------------------------------------

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("galaxy_name", "string", "galaxy name")
definition.add_optional("image", "file_path", "image path")

# Get the configuration
config = parse_arguments("attenuation", definition)

# -----------------------------------------------------------------

# Create attenuation object
if config.image is not None:
    wcs = CoordinateSystem.from_file(config.image)
    attenuation = GalacticAttenuation(wcs.bounding_box.center)
    # or attenuation = GalacticAttenuation(wcs.center_sky)
else: attenuation = GalacticAttenuation(config.galaxy_name)

# -----------------------------------------------------------------

#specs = categorize_filters()
#for label in categorized_filters_sorted_labels(specs):
#    filter_names = specs[label]
#    curve = extinction.extinction_curve(filter_names)
#    plot = Plot()
#    plot.add_curve(curve, "hello")
#    plot.finish()

# -----------------------------------------------------------------
Ejemplo n.º 6
0
# -----------------------------------------------------------------

data_path = fs.join(modeling_path, "data")
prep_path = fs.join(modeling_path, "prep")

galex_images_path = fs.join(data_path, "images", "GALEX")
sdss_images_path = fs.join(data_path, "images", "SDSS")

# -----------------------------------------------------------------

# Path to the reference image
reference_path = fs.join(prep_path, "Pacs red", "initialized.fits")

# Load the reference wcs
reference_wcs = CoordinateSystem.from_file(reference_path)

# Get center coordinate
center_coordinate = reference_wcs.coordinate_range[0]

# -----------------------------------------------------------------

# Create the galactic attenuation calculator
attenuation = GalacticAttenuation(center_coordinate)

# -----------------------------------------------------------------

# The aniano kernels service
aniano = AnianoKernels()

# -----------------------------------------------------------------