EranOfek / AstroPack

Astronomy & Astrophysics Software Pacakge
Other
16 stars 4 forks source link

An update of the imUtil.art toolkit #451

Closed agioffe closed 1 month ago

agioffe commented 1 month ago

According to the discussion with @EranOfek and @yossishv, the imUtil.art set of tools has been updated. In particular, the functionality has been split into smaller separate functions following the logic outlined below.

Now the major steps in constructing of an artificial sky image are:

  1. imUtil.art.createSourceCube - given a list of source positions, their fluxes, and a cube / cell array of their PSFs, it builds a cube / cell array of fluxed PSF stamps, optionally rescaled, rotated, made odd-sized, and fft-shifted to whole pixel positions. This function makes use of the new tool imUtil.psf.shift_resample_rotate which does a resampling of a PSF stack / cell array down to oversampling = 1, makes it odd-sized, rotates, and shifts.
  2. imUtil.art.injectSources - inject odd-sized fluxed source images (PSFs) prepared with imUtil.art.createSourceCube into whole pixel positions of an image; NB: the previous version of imUtil.art.injectSources written by N. Segev is now kept an a side option ('Method','NS'). As Noam is obviously the only user of this function, it would be advisable for him to test the new way of doing things, and if he doesn't meet any substantial obstacles, switch to it completely. In such a case we will obsolete the old function. 2a. imUtil.art.subtractSources -- calls imUtil.art.injectSources with 'Subtract', 'true'
  3. imUtil.art.addBackground - adds single-valued or per pixel background to an image or subtract the background from it
  4. imUtil.art.addNoise - applies normal or Poisson noise to an image (with or without background)

Also, imUtil.art.unitTest - tests some of the imUtil.art functions with a fully artificial case (if needed I will add an example with some real LAST image)

P.S. Changes in imUtil.art required some refurbishing of ultrasat.usim -- some of ULTRASAT-specific functionality has been moved inside this function.