Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifying Datasets. #47

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
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 autometacal/python/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import autometacal.python.datasets as datasets
from autometacal.python import datasets
import autometacal.python.tf_ngmix as tf_ngmix
from autometacal.python.metacal import generate_mcal_image, get_metacal_response, get_metacal_response_finitediff
from autometacal.python.fitting import fit_multivariate_gaussian, get_ellipticity
Expand Down
26 changes: 4 additions & 22 deletions autometacal/python/datasets/CFIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def __init__(self, *, galaxy_type="parametric",
pixel_scale: pixel scale of stamps in arcsec.
**kwargs: keyword arguments forwarded to super.
"""
v1 = tfds.core.Version("0.0.1")
v1 = tfds.core.Version("0.5.0")
super(CFISConfig, self).__init__(
description=("Galaxy stamps"),
description=("CFIS-like Galaxy stamps"),
version=v1,
**kwargs)

Expand All @@ -49,7 +49,7 @@ class CFIS(tfds.core.GeneratorBasedBuilder):

VERSION = tfds.core.Version('0.0.1')
RELEASE_NOTES = {
'0.0.1': 'Initial release.',
'0.5.0': 'Initial release.',
}

BUILDER_CONFIGS = [CFISConfig(name="parametric_1k", galaxy_type="parametric", data_set_size=1000),
Expand All @@ -68,12 +68,7 @@ def _info(self) -> tfds.core.DatasetInfo:
'psf': tfds.features.Tensor(shape=[self.builder_config.stamp_size,
self.builder_config.stamp_size],
dtype=tf.float32),
# 'gal_kimage': tfds.features.Tensor(shape=[2, self.builder_config.kstamp_size,
# self.builder_config.kstamp_size],
# dtype=tf.float32),
# 'psf_kimage': tfds.features.Tensor(shape=[2, self.builder_config.kstamp_size,
# self.builder_config.kstamp_size],
# dtype=tf.float32),

"noise_std": tfds.features.Tensor(shape=[1], dtype=tf.float32),
"mag": tfds.features.Tensor(shape=[1], dtype=tf.float32),
}),
Expand Down Expand Up @@ -109,9 +104,6 @@ def _generate_examples(self, size):
psf = gs.Kolmogorov(fwhm=self.builder_config.psf_fwhm, flux=1.0)
psf = psf.shear(g1=self.builder_config.psf_e1, g2=self.builder_config.psf_e2)

# Prepare borders for kimage
Nk = self.builder_config.kstamp_size
bounds = gs._BoundsI(-Nk//2, Nk//2-1, -Nk//2, Nk//2-1)

for i in range(size):
# retrieving galaxy and magnitude
Expand All @@ -134,17 +126,7 @@ def _generate_examples(self, size):
scale=self.builder_config.pixel_scale
).array.astype('float32')

# gal_kimage = gal.drawKImage(bounds=bounds,
# scale=2.*np.pi/(self.builder_config.stamp_size*self.builder_config.pixel_scale),
# recenter=False).array.astype('complex64')

# psf_kimage = psf.drawKImage(bounds=bounds,
# scale=2.*np.pi/(self.builder_config.stamp_size*self.builder_config.pixel_scale),
# recenter=False).array.astype('complex64')

yield '%d'%i, {"obs": gal_stamp,
"psf": psf_stamp,
# "gal_kimage": np.stack([gal_kimage.real, gal_kimage.imag]),
# "psf_kimage": np.stack([psf_kimage.real, psf_kimage.imag]),
"noise_std": np.array([np.sqrt(sky_level)]).astype('float32'),
"mag": np.array([gal_mag]).astype('float32')}
6 changes: 3 additions & 3 deletions autometacal/python/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""gal_gen dataset."""
"""galaxy datasets"""

from .gal_gen import GalGen
from .CFIS import CFIS
from .galgen import GalGen
from .CFIS import CFIS
131 changes: 0 additions & 131 deletions autometacal/python/datasets/gal_gen.py

This file was deleted.

Loading