GithubHelp home page GithubHelp logo

cweb_psf's Issues

Refactor PSF fitting & catalog-augmenting code

The PSF fitting and catalog making, filtering, and augmenting are all happening in an unholy loop in get_galaxy_cutouts.py. Many of the scripts in runners are also now deprecated.

The various functions in get_galaxy_cutouts should be separated into classes that can be imported by a runner script.

Webb PSF Plots

Lines 284-287 in src/psfmaker.py instantiate a single image Webb Model by accessing ['PSF_DATA']. This is housed in a try except block, however, both the initial attempt and exception failed to parse single['PSF_DATA']. In trying to unpack this I loaded a webbPSF model in an ipython session and got the same key error: KeyError: "Extension 'PSF_DATA' not found." The program still ran to completion.

Unused arguments

In line 119 of src/psfmaker.py, psm_im is instantiated with make_single, supplying arguments for x and y with x_pos = x , y_pos = y. x_pos and y_pos are arguments for _make_single, however, x_pos and y_pos are not used within the make_single function itself so I'm not sure why they are arguments. In _make_pexim make_piff, x_pos and y_pos are used to specify the location of the psf model, so my main concern would be that make_single is supposed to make webb psfs that very across the field of view, but is instead displaying the same webb PSF for each (x,y) pair. If this is the case, a fix might be adding an nc.detector_position somewhere. If this is not the case, I think that the x_pos y_pos may be removed as arguments in line 271 and in line 119. In render_psf, the x and y arguments would be optional depending on the psf type.

Os path join errors

The python debugger showcases the following error when running get_jwst_psf.py:

/home/eddieberman/research/mcclearygroup/cweb_psf/get_jwst_psf.py(122)run_sextractor()
-> cmd = ' '.join([
(Pdb) catname
*** NameError: name 'catname' is not defined
(Pdb) cat_name
'/research/mcclearygroup/mock_data/mosaics/COSMOS2020_sims//research/mcclearygroup/mock_data/mosaics/COSMOS2020_sims/mosaic_nircam_f115w_COSMOS-Web_cat.fits'
(Pdb) outdir
'~/research/mcclearygroup/mock_data/mosaics/COSMOS2020_sims'

Bad pixel sentinel values need to be configurable!

The sentinel value for bad pixels in make_starcat() is hardcoded:

    # Filter out saturated stars
    badstar_ext = 'ERR_VIGNET'; sentinel = 0
    #badstar_ext = 'DQ_VIGNET'; sentinel = [1, 2]

    selected_stars = _exclude_satpix(selected_stars,
                                     ext=badstar_ext,
                                     sentinel=sentinel
                                     )

This needs to be made a configurable value, since sentinel values differ for single exposures (cal files) and mosaics. Otherwise, the star selection is too restrictive for single exposures.

Near term to-do list

To make this codebase more useful for the rest of the collaboration as an independent PSF fitting and diagnostic tool, the following tasks need to be completed. This list will be updated as we proceed and new scripts get added.

  • Add capability to use external reference star catalog for PSF fitting in get_jwst_psf.py
  • Add a decorator to PIFF models that adds the PSFEx functionality required by Sextractor++
  • Run PSFEx model in get_jwst_psf.py
  • Remove hard-coded image names!
  • Turn this hard-coded star selection function into a configuration file that can be adapted for other data and passed to the PSF fitting code. Useful for cases where a reference catalog is not provided.
  • Make PIFF auto-star selection work
  • Possibly turn this loop into a class, especially since variables get passed back and forth between functions. Perhaps not strictly necessary, but would clean up code a bit.
  • Push PSF data products to Candide for others to use
  • Add Tobias Liaudat tools?

Detector Name

WebbPSF expects detector names to be '5' and not 'LONG', for example 'NRCB5' instead of 'NRCBLONG'. Line 26 declares detector = imhead['DETECTOR'] which will cause an error for longer wavelengths.

This can be fixed with detector = imhead['DETECTOR'].replace('LONG', '5')

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.