Skip to content

Commit

Permalink
Merge pull request #6 from ssc-ai/r0.16.0
Browse files Browse the repository at this point in the history
v0.16.0
  • Loading branch information
mixxen authored Jun 13, 2023
2 parents 157989b + 87733a1 commit cfab0f8
Show file tree
Hide file tree
Showing 12 changed files with 229 additions and 118 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
History
=======

0.16.0
---------------------

* Add option to annotate stars. Set sim option `star_annotation_threshold` to the minimum star brightness magnitude or `false` to disable. Disabled by default.
* Add option to show annotated stars in annotated images. Set sim option `show_star_boxes` to `true` to enable.


0.15.1
---------------------

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ 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.15.1 -t satsim:latest -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .
docker build -t satsim:0.16.0 -t satsim:latest -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .

dind:
docker run --rm -it -v $(CURDIR):/workspace/ -w /workspace python:3.8-bullseye ./build.sh
docker build -t satsim:0.15.1 -t satsim:latest -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .
docker run --rm -it -v .:/workspace/ -w /workspace python:3.8-bullseye ./build.sh
docker build -t satsim:0.16.0 -t satsim:latest -f docker/ubuntu20.04_cuda11.2_py3.8.dockerfile .

uninstall: clean
cat .install.log | xargs rm -rf
12 changes: 6 additions & 6 deletions docker/ubuntu20.04_cuda11.2_py3.8.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
RUN pip3 install --no-cache-dir --upgrade pip setuptools

# copy and install satsim wheel file
ENV SATSIM_VERSION='0.15.1'
COPY dist/satsim-0.15.1-py2.py3-none-any.whl /tmp
ENV SATSIM_VERSION='0.16.0'
COPY dist/satsim-0.16.0-py2.py3-none-any.whl /tmp

# install python prereqs and satsim
RUN pip3 --no-cache-dir install \
imageio==2.15.0 \
tensorflow~=2.8.0 \
tensorflow-addons~=0.16.1 \
tmp/satsim-0.15.1-py2.py3-none-any.whl
tmp/satsim-0.16.0-py2.py3-none-any.whl

RUN pip3 --no-cache-dir install \
jupyterlab \
scikit-learn \
virtualenv

# copy and install satsim wheel file
ENV SATSIM_VERSION='0.15.1'
COPY dist/satsim-0.15.1-py2.py3-none-any.whl /tmp
RUN pip3 install tmp/satsim-0.15.1-py2.py3-none-any.whl
ENV SATSIM_VERSION='0.16.0'
COPY dist/satsim-0.16.0-py2.py3-none-any.whl /tmp
RUN pip3 install tmp/satsim-0.16.0-py2.py3-none-any.whl

RUN mkdir /workspace
WORKDIR /workspace
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.15.1'
version = '0.16.0'
# The full version, including alpha/beta/rc tags.
release = '0.15.1'
release = '0.16.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
22 changes: 0 additions & 22 deletions requirements.txt

This file was deleted.

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.15.1'
__version__ = '0.16.0'

from .satsim import gen_images, gen_multi, image_generator
from .config import load_json, load_yaml
4 changes: 2 additions & 2 deletions satsim/dataset/augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def _augment_satnet_with_satsim(image, bboxs, filename=None, annotational_filena
sspc['augment']['image']['post'] = tf.squeeze(image)

ig = image_generator(sspc, with_meta=True)
fpa_digital, frame_num, astrometrics, obs_os_pix, fpa_conv_star, fpa_conv_targ, bg_tf, dc_tf, rn_tf, num_shot_noise_samples, obs_cache, ground_truth = ig.__next__()
fpa_digital, frame_num, astrometrics, obs_os_pix, fpa_conv_star, fpa_conv_targ, bg_tf, dc_tf, rn_tf, num_shot_noise_samples, obs_cache, ground_truth, star_os_pix = ig.__next__()

anno = init_annotation('.', 0, h, w, y_fov, x_fov)
snr = signal_to_noise_ratio(fpa_conv_targ, tf.squeeze(image) * a2d_gain, rn)
set_frame_annotation(anno, ['null'], h * s_osf, w * s_osf, obs_os_pix, snr=snr)
set_frame_annotation(anno, ['null'], h * s_osf, w * s_osf, obs_os_pix, snr=snr, star_os_pix=star_os_pix)

unbboxs = tf.unstack(bboxs)
for ii in range(len(unbboxs)):
Expand Down
13 changes: 7 additions & 6 deletions satsim/io/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from skimage.draw import rectangle_perimeter


def save(filename, fpa, vauto=False, vmin=None, vmax=None, cmap='gray', annotation=None, pad=5, show_obs_boxes=True):
def save(filename, fpa, vauto=False, vmin=None, vmax=None, cmap='gray', annotation=None, pad=5, show_obs_boxes=True, show_star_boxes=False):
"""Save an array as an image file.
Args:
Expand Down Expand Up @@ -37,13 +37,14 @@ def save(filename, fpa, vauto=False, vmin=None, vmax=None, cmap='gray', annotati

fpa_np = fpa

if annotation is not None and show_obs_boxes is True:
if annotation is not None and (show_obs_boxes is True or show_star_boxes is True):
(h, w) = fpa_np.shape
for a in annotation:
start = (a['y_min'] * h - pad, a['x_min'] * w - pad)
end = (a['y_max'] * h + pad, a['x_max'] * w + pad)
rr, cc = rectangle_perimeter(start, end=end, shape=fpa_np.shape)
fpa_np[rr,cc] = 100000000
if (show_obs_boxes and a['class_name'] == 'Satellite') or (show_star_boxes and a['class_name'] == 'Star'):
start = (a['y_min'] * h - pad, a['x_min'] * w - pad)
end = (a['y_max'] * h + pad, a['x_max'] * w + pad)
rr, cc = rectangle_perimeter(start, end=end, shape=fpa_np.shape)
fpa_np[rr,cc] = 100000000

mpimg.imsave(filename, fpa_np, vmin=min_val, vmax=max_val, cmap=cmap)

Expand Down
Loading

0 comments on commit cfab0f8

Please sign in to comment.