Giter Site home page Giter Site logo

gunagala's Issues

crval not set before imager.make_noiseless_image is run

Crafting a PSF using a simulated galaxy, where I hacked together a new instance of a Huntsman imager:

huntsman_galaxy = imager.Imager(optic=huntsman.optic,
                        camera=huntsman.camera,
                        filters=huntsman.filters,
                        psf=galaxy_psf,
                        sky=huntsman.sky)

Solution was to call huntsman_galaxy.get_pixel_coords(centre), which sets self.wcs.wcs.crval and allows imager.make_noiseless_image to run.

use spatially-varying PSFs

Modify convolution so it does a direct convolution as the Fourier convolution won't work too well. Have .a hybrid convolution: at a certain radius the Fourier does the PSF wings, while the core is done via direct convolution.

Getting the LTS test working again

The test timed out and did not pass with the following error:

No output has been received in the last 10m0s, this potentially indicates a
stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on:
https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-
was-received
The build has been terminated.

Probably need to update .travis.yml and maybe setup.py and setup.cfg based on the latest version of the astropy template.

Refactor Imager instantiation

Currently Imager can be created either fully automatically using the create_imagers() function, where all parameters are set in the performance.yaml config file, or completely in Python where all the subcomponents (Optic, Camera, etc.) have to be manually instantiated with all their parameters passed to the constructor.

More useful would be an option to create an Imager in Python by simply referencing the names of either a predefined Imager or a selection of subcomponents that are then generated from the config file. Basically the Imager constructor should, optionally, be passed either one name (one of the Imager pre-defined in performance.yaml file) or some combination of subcomponent objects or names of subcomponent from the performance.yaml file.

This will make interact creation of Imager objects much easier.

None value for MoffatPSF.n_pix and MoffatPSF.peak

While I use these initial values for MoffatPSF and PixellatedPSF (just like what we do in test_psf.py):

psf_moffat = MoffatPSF(FWHM=1 / 30 * u.arcminute, shape=4.7)

psf_data = np.array([[0.0, 0.0, 0.1, 0.0, 0.0],
                     [0.0, 0.3, 0.7, 0.4, 0.0],
                     [0.1, 0.8, 1.0, 0.6, 0.1],
                     [0.0, 0.2, 0.7, 0.3, 0.0],
                     [0.0, 0.0, 0.1, 0.0, 0.0]])
psf_pixellated = PixellatedPSF(psf_data=psf_data,
                     psf_sampling=1 * u.arcsecond / u.pixel,
                     psf_centre=(2, 2),
                     oversampling=10,
                     pixel_scale=(2 / 3) * u.arcsecond / u.pixel)

There are proper values for psf_pixellated.n_pix and psf_pixellated.peak but for psf_moffat.n_pix and psf_moffat.peak the values are None.

I found out that pixel_scale for psf_moffat is None value as well and that might be the reason why the other two n_pix and peak are None as they seems to be related to pixel_scale as follow lines in psf.py:

266        if self.pixel_scale:
267            self._update_model()

And it is strange, before implementing pytest.mark.parametrize, how test_psf.py does work while these values are None?! Does it mean, for instance here:

def test_peak(psf_moffat):
    assert psf_moffat.peak == 0.7134084656751443 / u.pixel

while the test is comparing None to a number, it just does noting and passes?

function to convolve image using Imager PSF

Use Fourier convolution in order to capture the impact of PSF wings. This will take as input a image, its pixel scale, its total brightness and an gunagala/Imager instance and produces an output image.

pep8 cleanup

When #38 is complete, one can just run:
tox -e codestyle
to easily see where there are some pep8 violations.

Reduce memory usage for simulated images with analytic PSFs

Currently Imager.make_noiseless_image evaluates analytic PSFs for every pixel in the ouput image, for every star in the image. With the oversampling evaluation method this results in some huge temporary arrays being created, which can easily consume all the free RAM. Some memory usage optimisation are required.

This issue has been blocking #16

Implement physically motivated PSF models

Currently the only PSF model is a Moffat function. With just 3 parameters (normalisation, width & 'shape') this can approximate real instrument PSFs pretty well, however there is no simple connection between the width & shape parameters of the model and physical parameters of the imaging system. This limits both the ability to predict the PSF of an instrument and the ability to infer information about an instrument from measured PSFs.

A rigorous approach to PSF modelling is beyond the scope of Gunagala, that's for end-to-end systems engineering models. Physically motivated PSF models can be introduced while retaining the parametric performance model nature of Gunagala, however. Components of these PSF models could include:

  1. Imager aperture -> Airy disc (generalised to include central obstruction)
  2. Kolmogorov/van Karman atmospheric turbulence spectrum -> seeing disc & wings
  3. Optical aberrations.
  4. Scattering from atmospheric aerosols.
  5. Scattering from optics.
  6. Tracking/guiding errors.

1-5 are wavelength dependent to varying degrees, some sort of band pass averaging will be required. For most instruments 1 and/or 2 will dominate, and simple models for 3, 4, 5 & 6 will be sufficient.

Improve Pytest in test_psf.py

There are some small jobs left to improve test_psf.py and since they are small jobs, they can be handled very soon.

a whole lot of warnings when unit tests are run

We've added:
-p no:warnings
to setup.cfg.

These are nearly all depreciation warnings, so this implies we need to fix just a few instances of outdated usage of e.g.:

gunagala/tests/test_optical_filter.py::test_aoi /Users/lspitler/miniconda3/envs/huntsman/lib/python3.7/site-packages/astropy/units/quantity.py:1060: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError. AstropyDeprecationWarning)

unagala/tests/test_camera.py::test_camera /Users/lspitler/miniconda3/envs/huntsman/lib/python3.7/site-packages/asdf/reference.py:11: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Sequence

/Users/lspitler/miniconda3/envs/huntsman/lib/python3.7/site-packages/matplotlib/backend_bases.py:57: DeprecationWarning: PILLOW_VERSION is deprecated and will be removed in a future release. Use __version__ instead. from PIL import PILLOW_VERSION

gunagala/tests/test_imager.py::test_create_imagers /Users/lspitler/prog/gunagala/gunagala/config.py:138: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. c = yaml.load(f.read())

gunagala/tests/test_imager.py::test_snr_vs_mag[r-SSO] /Users/lspitler/miniconda3/envs/huntsman/lib/python3.7/site-packages/astropy/units/quantity.py:477: RuntimeWarning: invalid value encountered in true_divide result = super().__array_ufunc__(function, method, *arrays, **kwargs)

become an astropy affiliated package

Aim is to become an affiliated package. Need to accomplish the following:

  • improve user experience to create custom instruments and PSFs e.g. #8 #1 #2
  • ensure use of existing astropy packages by fixing a few depreciation warnings and out of date dependencies #30 #43
  • adopt astropy base package template (almost done) and help determine best workflow for maintenance (e.g. release schedule) #38 #40
  • provide key useful features: analytical PSF memory error fix #29 ; implement spatially-varying PSF #23 PSF wings #21 physically motivated PSF #4

something odd with offsets

If one changes the pixellated PSF offset, it appears that the regions without PSF coverage flip between zero and nan. Difference these two images:

screen shot 2018-06-12 at 3 10 45 pm

screen shot 2018-06-12 at 3 10 55 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.