Skip to content

Commit

Permalink
Merge pull request #16 from ssc-ai/r0.19.2
Browse files Browse the repository at this point in the history
v0.19.2
  • Loading branch information
mixxen authored Oct 25, 2024
2 parents 28b9809 + c4f8117 commit c5fd46a
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 21 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
History
=======

0.19.2
---------------------

* Add `rate-sidereal` track mode. This mode takes n - 1 rate track frames and the last frame in sidereal tracking mode.


0.19.1
---------------------

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ install: clean ## install the package to the active python3's site-packages
@echo IMPORTANT: You may need to close and restart your shell after running "make install".

docker: docs dist
docker build -t satsim:0.19.1 -t satsim:latest -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .
docker build -t satsim:0.19.2 -t satsim:latest -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .

dind:
docker run --rm -it -v .:/workspace/ -w /workspace python:3.8-bullseye ./build.sh
docker build -t satsim:0.19.1-cuda11.2 -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .
docker build -t satsim:0.19.1-cuda11.8 -t satsim:0.19.1 -t satsim:latest -f docker/ubuntu22.04_cuda11.8_py3.10.dockerfile .
docker build -t satsim:0.19.2-cuda11.2 -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .
docker build -t satsim:0.19.2-cuda11.8 -t satsim:0.19.2 -t satsim:latest -f docker/ubuntu22.04_cuda11.8_py3.10.dockerfile .

uninstall: clean
cat .install.log | xargs rm -rf
6 changes: 3 additions & 3 deletions docker/ubuntu20.04_cuda11.2_py3.8.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ RUN pip3 --no-cache-dir install --upgrade pip setuptools
RUN pip3 --no-cache-dir install tensorflow~=2.11.0

# copy wheel file
ENV SATSIM_VERSION='0.19.1'
COPY dist/satsim-0.19.1-py2.py3-none-any.whl /tmp
ENV SATSIM_VERSION='0.19.2'
COPY dist/satsim-0.19.2-py2.py3-none-any.whl /tmp

# install satsim wheel file together with jupyterlab so dependency compatibility are resolved
RUN pip3 --no-cache-dir install \
tmp/satsim-0.19.1-py2.py3-none-any.whl \
tmp/satsim-0.19.2-py2.py3-none-any.whl \
jupyterlab \
scikit-learn \
virtualenv
Expand Down
6 changes: 3 additions & 3 deletions docker/ubuntu22.04_cuda11.8_py3.10.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ RUN pip3 --no-cache-dir install --upgrade pip setuptools
RUN pip3 --no-cache-dir install tensorflow~=2.13.0

# copy wheel file
ENV SATSIM_VERSION='0.19.1'
COPY dist/satsim-0.19.1-py2.py3-none-any.whl /tmp
ENV SATSIM_VERSION='0.19.2'
COPY dist/satsim-0.19.2-py2.py3-none-any.whl /tmp

# install satsim wheel file together with jupyterlab so dependency compatibility are resolved
RUN pip3 --no-cache-dir install \
tmp/satsim-0.19.1-py2.py3-none-any.whl \
tmp/satsim-0.19.2-py2.py3-none-any.whl \
jupyterlab \
scikit-learn \
virtualenv
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
# the built documents.
#
# The short X.Y version.
version = '0.19.1'
version = '0.19.2'
# The full version, including alpha/beta/rc tags.
release = '0.19.1'
release = '0.19.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion satsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = """Alex Cabello"""
__email__ = '[email protected]'
__version__ = '0.19.1'
__version__ = '0.19.2'

from .satsim import gen_images, gen_multi, image_generator
from .config import load_json, load_yaml
34 changes: 28 additions & 6 deletions satsim/satsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def image_generator(ssp, output_dir='.', output_debug=False, dir_debug='./Debug'
astrometrics['lat'] = ssp['geometry']['site']['lat']
astrometrics['lon'] = ssp['geometry']['site']['lon']
astrometrics['alt'] = ssp['geometry']['site'].get('alt', 0)
astrometrics['track_mode'] = track_mode
astrometrics['track_mode'] = _parse_track_mode(track_mode, 0, num_frames)
observer = create_topocentric(astrometrics['lat'], astrometrics['lon'], astrometrics['alt'])

if 'tle' in ssp['geometry']['site']['track']:
Expand Down Expand Up @@ -535,7 +535,7 @@ def image_generator(ssp, output_dir='.', output_debug=False, dir_debug='./Debug'
y_fov_pad, x_fov_pad,
y_fov, x_fov,
y_ifov, x_ifov,
observer, track, star_rot, track_mode, track_az, track_el)
observer, track, star_rot, astrometrics['track_mode'], track_az, track_el)
else:
observer = None
track = None
Expand Down Expand Up @@ -593,6 +593,7 @@ def image_generator(ssp, output_dir='.', output_debug=False, dir_debug='./Debug'
tic('gen_frame', frame_num)
logger.debug('Generating frame {} of {}.'.format(frame_num + 1, num_frames))
astrometrics['frame_num'] = frame_num + 1
astrometrics['track_mode'] = _parse_track_mode(track_mode, frame_num, num_frames)

if ssp['sim']['psf_sample_frequency'] == 'frame':
psf_os = _gen_psf(ssp, h_sub_pad_os, w_sub_pad_os, y_ifov, x_ifov, s_osf)
Expand All @@ -603,11 +604,12 @@ def image_generator(ssp, output_dir='.', output_debug=False, dir_debug='./Debug'
ts_end = time.utc_from_list(tt, t_end)
t_start_star = t_start
t_end_star = t_end
t_frame_track_start = _parse_start_track_time(track_mode, frame_num, num_frames, ts_collect_start, ts_start)

# calculate object pixels
r_obs_os, c_obs_os, pe_obs_os, obs_os_pix, obs_model = _gen_objects(ssp, render_mode,
obs, obs_cache,
ts_collect_start, ts_collect_end, t_start, t_end, tt,
t_frame_track_start, ts_collect_end, t_start, t_end, tt,
observer, track, track_az, track_el,
zeropoint, s_osf,
h_fpa_os, w_fpa_os,
Expand All @@ -616,17 +618,17 @@ def image_generator(ssp, output_dir='.', output_debug=False, dir_debug='./Debug'
h_fpa_pad_os, w_fpa_pad_os,
y_fov, x_fov,
y_to_pix, x_to_pix,
star_rot, track_mode)
star_rot, astrometrics['track_mode'])
logger.debug('Number of objects {}.'.format(len(obs_os_pix)))

if track_mode is not None:
star_ra, star_dec, star_tran_os, star_rot_rate = _calculate_star_position_and_motion(ssp, astrometrics,
ts_collect_start, ts_collect_end, ts_start, ts_end, t_exposure,
t_frame_track_start, ts_collect_end, ts_start, ts_end, t_exposure,
h_fpa_pad_os, w_fpa_pad_os,
y_fov_pad, x_fov_pad,
y_fov, x_fov,
y_ifov, x_ifov,
observer, track, star_rot, track_mode, track_az, track_el)
observer, track, star_rot, astrometrics['track_mode'], track_az, track_el)

# if image rendering is disabled, then return
if ssp['sim']['mode'] == 'none':
Expand Down Expand Up @@ -1123,3 +1125,23 @@ def _calculate_star_position_and_motion(ssp, astrometrics,
logger.debug('Boresight RA, Dec, Roll, Az, El: {}, {}, {}, {}, {}.'.format(astrometrics['ra'], astrometrics['dec'], astrometrics['roll'], astrometrics['az'], astrometrics['el']))

return star_ra0, star_dec0, star_tran_os, star_rot_rate


def _parse_track_mode(track_mode, frame_num, total_frames):
if track_mode is not None and track_mode == 'rate-sidereal':
if frame_num < total_frames - 1: # TODO make this more general, only supports last frame
return 'rate'
else:
return 'sidereal'

return track_mode


def _parse_start_track_time(track_mode, frame_num, total_frames, ts_collect_start, ts_start):
if track_mode is not None and track_mode == 'rate-sidereal':
if frame_num < total_frames - 1: # TODO make this more general, only supports last frame
return ts_collect_start
else:
return ts_start

return ts_collect_start
2 changes: 1 addition & 1 deletion schema/v1/Geometry.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"mode": {
"description": "The track mode.",
"type": "string",
"enum": ["rate", "sidereal"]
"enum": ["rate", "sidereal", "fixed", "rate-sidereal"]
},
"tle": {
"description": "The TLE SGP4 orbit as an array.",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.19.1
current_version = 0.19.2
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/ssc-ai/satsim',
version='0.19.1',
version='0.19.2',
zip_safe=False,
)
13 changes: 13 additions & 0 deletions tests/test_satsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,19 @@ def test_poppy():
assert(hdulhdr['EXPTIME'] == ssp['fpa']['time']['exposure'])
assert(hdulhdr['TRKMODE'] == ssp['geometry']['site']['track']['mode'])

ssp['fpa']['num_frames'] = 2
ssp['geometry']['site']['track']['mode'] = 'rate-sidereal'
dir_name = gen_images(ssp, eager=True, output_dir='./.images', output_debug=True, queue=queue)
queue.waitUntilEmpty()
hdul = afits.open(os.path.join(dir_name, 'ImageFiles', 'sat_00000.0000.fits'))
hdulhdr = hdul[0].header
assert(hdulhdr['EXPTIME'] == ssp['fpa']['time']['exposure'])
assert(hdulhdr['TRKMODE'] == 'rate')
hdul = afits.open(os.path.join(dir_name, 'ImageFiles', 'sat_00000.0001.fits'))
hdulhdr = hdul[0].header
assert(hdulhdr['EXPTIME'] == ssp['fpa']['time']['exposure'])
assert(hdulhdr['TRKMODE'] == 'sidereal')

ssp['geometry']['site']['track']['mode'] = 'rate'
ssp['geometry']['site']['track']['position'] = [-35180.62550265, -23252.99066344, 92.95410805]
ssp['geometry']['site']['track']['velocity'] = [1.69553697, -2.56443628, 1.12318636e-03]
Expand Down

0 comments on commit c5fd46a

Please sign in to comment.