Skip to content

Commit

Permalink
fill out ephemeris used to determine velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
stscieisenhamer committed Nov 15, 2024
1 parent 2b8152a commit 74aafc5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 0 additions & 4 deletions romanisim/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,10 +879,6 @@ def make_asdf(slope, slopevar_rn, slopevar_poisson, metadata=None,
# ref_file: conceptually sound when we work from crds reference
# files
# target: can push forward from APT file
# velocity_aberration: I guess to first order,
# ignore the detailed orbit around L2 and just project
# the earth out to L2, and use that for the velocity
# aberration? Don't do until someone asks.
# visit: start_time, end_time, total_exposures, ...?
# wcsinfo: v2_ref, v3_ref, vparity, v3yangle, ra_ref, dec_ref
# roll_ref, s_region
Expand Down
10 changes: 9 additions & 1 deletion romanisim/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
'detector': 'WFI07',
'optical_element': 'F184',
},
'ephemeris': {'time': Time('2026-01-01').mjd,
'spatial_x': 0.,
'spatial_y': 0.,
'spatial_z': 0.,
'velocity_x': 0.,
'velocity_y': 0.,
'velocity_z': 0.
},
'exposure': {'start_time': Time('2026-01-01T00:00:00'),
'type': 'WFI_IMAGE',
'ma_table_number': 1,
Expand All @@ -44,6 +52,7 @@
'target_dec': 66.0,
'target_aperture': 'WFI_CEN',
},
'velocity_aberration': {'scale_factor': 1.0},
'wcsinfo': {'aperture_name': 'WFI_CEN',
'pa_aperture': 0.,
'ra_ref': 270.0,
Expand All @@ -56,7 +65,6 @@
# I don't know what vparity and v3yangle should really be,
# but they are always -1 and -60 in existing files.
},
'velocity_aberration': {'scale_factor': 1.0},
}

# Default metadata for level 3 mosaics
Expand Down
13 changes: 13 additions & 0 deletions romanisim/ris_make_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from astropy import table
from astropy import time
from astropy import coordinates
from astropy import units as u
import galsim
from galsim import roman
import roman_datamodels
Expand Down Expand Up @@ -98,6 +99,18 @@ def set_metadata(meta=None, date=None, bandpass='F087', sca=7,
scale_factor = calc_scale_factor(meta['exposure']['start_time'], meta['wcsinfo']['ra_ref'], meta['wcsinfo']['dec_ref'])

Check warning on line 99 in romanisim/ris_make_utils.py

View check run for this annotation

Codecov / codecov/patch

romanisim/ris_make_utils.py#L99

Added line #L99 was not covered by tests
meta['velocity_aberration']['scale_factor'] = scale_factor

# Fill out some ephemeris information, presuming all is earth.
position, velocity = coordinates.get_body_barycentric_posvel('earth', meta['exposure']['start_time'])
position = position.xyz.to(u.km)
velocity = velocity.xyz.to(u.km / u.s)
meta['ephemeris']['time'] = meta['exposure']['start_time'].mjd
meta['ephemeris']['spatial_x'] = position.value[0]
meta['ephemeris']['spatial_y'] = position.value[1]
meta['ephemeris']['spatial_z'] = position.value[2]
meta['ephemeris']['velocity_x'] = velocity.value[0]
meta['ephemeris']['velocity_y'] = velocity.value[1]
meta['ephemeris']['velocity_z'] = velocity.value[2]

return meta


Expand Down

0 comments on commit 74aafc5

Please sign in to comment.