Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
pip install -U -r requirements.txt

# Extra packages needed for testing
pip install -U nose coverage "pytest<8" nbval ipykernel pillow
pip install -U nose coverage pytest nbval ipykernel pillow sep asdf gwcs

# ngmix isn't on pypi
pip install -U numba git+https://github.com/esheldon/ngmix.git
Expand Down
498 changes: 498 additions & 0 deletions devel/roman/asdf_to_fits.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/roman.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Roman PSF module
Classes and functions that are specific to the Nancy Grace Roman Space Telescope
live in the sub-module piff.roman. They include the following:

.. autoclass:: piff.roman.RomanGWCS
:members:

.. autoclass:: piff.roman.RomanFiles
:members:

.. autoclass:: piff.roman.RomanOpticsPSF
:members:

Expand Down
2 changes: 1 addition & 1 deletion piff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
from .outliers import Outliers, ChisqOutliers, CentroidOutliers

# Input handlers are named InputBlah where Blah is what they are called in the config file
from .input import Input, InputFiles
from .input import Input, InputFiles, RawImageData
from .select import Select, FlagSelect, PropertiesSelect
from .star import Star, StarData, StarFit
from .star import set_shape_method, get_shape_method, get_shape_weight_fwhm
Expand Down
22 changes: 22 additions & 0 deletions piff/config_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""

import galsim
import os


def _GenerateImageHeaderValue(config, base, value_type):
Expand All @@ -30,11 +31,32 @@ def _GenerateImageHeaderValue(config, base, value_type):
raise ValueError("ImageHeaderValue requires base['_current_image'] to be set.")

header = base['_current_image'].header
if header is None:
raise ValueError('Current image has no header information. Required for ImageHeaderValue.')
if key not in header:
raise KeyError("Key %s not found in FITS header" % key)

return header[key], safe


def _GenerateASDFValue(config, base, value_type):
"""Read scalar metadata from an ASDF file using a dotted path.
"""
import asdf
from .util import get_asdf_value

req = { 'file_name': str, 'path': str }
opt = { 'dir': str }
kwargs, safe = galsim.config.GetAllParams(config, base, req=req, opt=opt)
file_name = kwargs['file_name']
if 'dir' in kwargs:
file_name = os.path.join(kwargs['dir'], file_name)
with asdf.open(file_name) as af:
value = get_asdf_value(af.tree, kwargs['path'])
return value, safe


galsim.config.RegisterValueType('ImageHeaderValue', _GenerateImageHeaderValue,
[float, int, bool, str, None])
galsim.config.RegisterValueType('ASDFValue', _GenerateASDFValue,
[float, int, bool, str, None])
11 changes: 2 additions & 9 deletions piff/des/decaminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.. module:: decaminfo
"""

from ..star import Star, StarFit, StarData
from ..star import Star
import numpy as np

class DECamInfo(object):
Expand Down Expand Up @@ -230,14 +230,7 @@ def pixel_to_focal_stardata(self, stardata):
properties = stardata.properties.copy()
properties['focal_x'] = focal_x[0]
properties['focal_y'] = focal_y[0]
for key in ['x', 'y', 'u', 'v']:
# Get rid of keys that constructor doesn't want to see:
properties.pop(key,None)
return StarData(image=stardata.image,
image_pos=stardata.image_pos,
weight=stardata.weight,
pointing=stardata.pointing,
properties=properties)
return stardata.withNew(properties=properties)

def pixel_to_focal(self, star):
"""Take star and add focal plane position to properties
Expand Down
Loading
Loading