Git Product home page Git Product logo

pandeia-coronagraphy's Introduction

Pandeia-Coronagraphy =====

Simulated NIRCam 210R scene with KLIP reference-subtraction

Installation ----

It is highly recommended that you begin by installing AstroConda (with python 3.x) and then follow these installation instructions to install the Pandeia engine and the required reference files. Once Pandeia is set up, the following command will install this package:

pip install git+git://github.com/spacetelescope/pandeia-coronagraphy.git

Alternatively, follow these step-by-step instructions:

  1. If you don't already have Anaconda or Miniconda installed, download and install the Python 3 version here.
  2. Add the AstroConda channel to your Conda channels:

conda config --add channels http://ssb.stsci.edu/astroconda

  1. Create a conda environment with the STScI software stack:

conda create -n astroconda stsci python=3

  1. Activate this environment with source activate astroconda. (NB: Conda is only compatible with a BASH shell.)
  2. Install the Pandeia engine following its instructions on JDox, in particular with this command: pip install pandeia.engine. (You should already have the Pysynphot package installed at this point. If you don't, install it with pip install pysynphot or conda install pysynphot. You can generate a list of installed packages with conda list.)
  3. Download and install the matching Pandeia data files and the PySynphot data files. See the instructions on JDox for links to current versions of these files.
  4. Add the following lines to your ~/.bashrc file (and source it after modifying):
export pandeia_refdata=/path/to/pandeia/data/directory
export PYSYN_CDBS=/path/to/cdbs/directory
  1. Finally, install the pandeia-coronagraphy package:

pip install git+git://github.com/spacetelescope/pandeia-coronagraphy.git

  1. (Optional, but highly recommended) Install WebbPSF with conda install webbpsf. This is required only if you are interested in using higher-fidelity PSFs in your calculations; otherwise, the Pandeia engine relies on interpolations of a bundled library of precomputed PSFs. This functionality is documented here and here.

Installing PySynphot Data Files ----

The entire PySynphot data file collection is quite large, and the PySynphot package expects a particular directory structure. If you're on the STScI network, you can skip this download and point the PYSYN_CDBS environment variable to the CDBS directory on central store instead (/grp/hst/cdbs). Otherwise, two (hopefully) helpful tips for installing the reference files locally:

  1. Rather than download every package, you may be able to get away with downloading only the Pysynphot Phoenix Models (ftp://archive.stsci.edu/pub/hst/pysynphot/synphot5.tar.gz).
  2. The .tar files will unpack to a directory structure that looks something like grp/hst/cdbs/etc. You'll need to consolidate the multiple structures into a single directory structure under cdbs. When setting up your environment variables in Step 7 (under Installation), you'll want to point to the cdbs directory directly.

Getting Started ----

Once installation is complete, take a look at the provided Jupyter notebooks for examples of constructing a scene, setting instrument properties, running the Pandeia engine, and performing some basic post-processing.

You can find a quickstart guide to using the Pandeia engine here.

Example input templates for the Pandeia engine are provided for coronagraphy here and for other instruments and observing modes here.

pandeia-coronagraphy's People

Contributors

kvangorkom avatar mperrin avatar muuud avatar polemarkh avatar york-stsci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandeia-coronagraphy's Issues

nircam and miri SGD notebook error due to NANs

Hello,

I have been testing the MIRI SGD notebook and running into issues when generating the KLIP reference. This is related to uncorrected nan's in the SGD reference images, possibly due to saturation artifacts, that cause the code to crash.

Here's what is in the original code -

reg = analysis.register_to_target(slope,target_slope,rescale_reference=True)
sgd_reg.append(reg)
sgd_reg = np.array(sgd_reg) 

I modified it in the following manner -

slope[np.isnan(slope)] = 0
reg = analysis.register_to_target(slope,target_slope,rescale_reference=True)
sgd_reg.append(reg) 

This does result in the central PSF artifact not getting completely removed in the target-reference but that could be corrected by drawing a mask on the central 0.1-0.2 arcsec.

multiple dithers error

Folks,

I think if a bug has been introduced by the newer version of pandeia.engine (1.2). I've been running the various notebooks here, but always get the error
UnsupportedError: Multiple dithers for imaging is not yet supported
when the calculation is attempted (i.e. in calculate_batch).

Installing pandeia.engine-1.1.1 seems to solve this issue, and with 1.2 I can successfully run the quickstart notebook from pandeia-tutorials, so my installs seem OK.

I'm not at all familiar with the inner workings on pandeia, so I haven't been able to figure out what the problem actually is and don't have any suggestions sorry!

cheers
Grant

Update README.rst

In the Installation section:

  • Update the repository URL from github.com/kvangorkom/ to github.com/spacetelescope/ in the pip commands (2 instances).
  • Use python 3.x instead of 2.7 in the conda create command.

Check for other outdated information.

jwst_pancake __init__.py

If the VERSION file is missing, from installing by hand the following lines in __init__.py prevent importing jwst_pancake

try:
    version_file = os.path.join(os.path.split(__file__)[0], "VERSION")
    with open(version_file, "r") as inf:
        __version__ = inf.readline().strip()
except Exception as e:
    sys.err.write("Unable to find pancake version file!\n")

sys.err should be replaced by sys.stderr

Sign error in fourier_shift function?

I've just noticed what I believe is a sign error in the fourier_shift function:

offset = fourier_shift( np.fft.fftn(image), (-yshift,xshift) )

Why is there a negative sign on the y shift but not on the x shift?

Note, this is a benign error if you avoid calling fourier_shift directly and instead invoke it through the register_to_target function (since the optimization in that function just solves for the required value with that sign error). But it's confusing if you try to directly access the fourier_shift function, or even if you just look at the output shifts as reported from register_to_target as a sanity check.

on-the-fly PSFs have a subpixel offset relative to precomputed library PSFs

Copying here from kvangorkom/pandeia-coronagraphy#13:

When the Pandeia library PSFs are generated, the requested offsets for the PSFs are forced to nearest integer upsampled pixel, and then recentered by a simple pixel remapping after the call to WebbPSF (so the convolution kernel created from the PSF is centered). For on-the-fly PSFs, I've intentionally avoided forcing the offset to an integer multiple of the upsampled pixel, since we care (particularly for MIRI) about small changes to these spatially-dependent PSFs. However, the pixel remapping approach then has the side effect of producing a slightly off-center convolution kernel.

Possible mitigation strategies: interpolate the PSF for the centering step (I really don't want to do this), or adopt a higher upsampling value.

PSF generated through on_the_fly True/False different

Hello,

I noticed that the PSFs appear to have different morphology depending on whether you use the pre-computed version or the webbpsf version. I've attached a figure showing the difference.

screen shot 2017-08-18 at 3 51 25 pm

All other parameters are kept consistent between the two calls.

Update the help

Tyler Desjardins mentions that we should consider moving emails from help[at]stsci.edu to point to the web portal where possible and appropriate. For HST (or any non-JWST), it is https://hsthelp.stsci.edu . For JWST, it is https://jwsthelp.stsci.edu . Please update info in setup.py, setup.cfg, documentation, etc as appropriate.

Please close this issue if it is irrelevant to your repository. This is an automated issue. If this is opened in error, please let pllim know!

xref spacetelescope/hstcal#317

Cleanup already-merged branches

Right now in addition to master, this repo has several branches: cache, contrasts, nircam_offsets, and pandeia1.1. I just checked and all of these appear to have already been merged into master at various points in the past; as far as I can tell there are no new commits on any of them.

Since they're already merged, I think they can & should be deleted at this point. Any objections?

NIRCam example notebook error

I was hoping to use one of the example notebooks (nircam_photon_noise_and_contrast.ipynb) to create a slope image, but I think there might have been an update to the pandeia engine that is causing an error in the notebook now. The error is below. Is there any way I could get an updated example notebook? I can't figure out a workaround for the geometries error because I don't know what the original code looked like.

`---------------------------------------------------------------------------
RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia_coronagraphy/engine.py", line 96, in perform_calculation
results = pandeia_calculation(calcfile)
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia/engine/perform_calculation.py", line 39, in perform_calculation
report = calculate_sn(calc_input, webapp=webapp)
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia/engine/etc3D.py", line 1230, in calculate_sn
scene = Scene(input=scene_configuration, webapp=webapp)
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia/engine/scene.py", line 54, in init
self._from_list(input)
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia/engine/scene.py", line 91, in _from_list
self.sources.append(src.Source(config=s, webapp=self.webapp))
File "/Users/acanipe/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia/engine/source.py", line 223, in init
if self.shape['geometry'] in self.geometries:
AttributeError: 'Source' object has no attribute 'geometries'
"""

The above exception was the direct cause of the following exception:

AttributeError Traceback (most recent call last)
in ()
1 engine.options.wave_sampling = 20
----> 2 targ_results, ref_results = engine.calculate_batch([target,reference])

~/miniconda3/envs/astroconda/lib/python3.5/site-packages/pandeia_coronagraphy/engine.py in calculate_batch(calcfiles, nprocesses)
66 nprocesses = mp.cpu_count()
67 pool = mp.Pool(processes = nprocesses)
---> 68 results = pool.map(perform_calculation, calcfiles)
69 pool.close()
70 pool.join()

~/miniconda3/envs/astroconda/lib/python3.5/multiprocessing/pool.py in map(self, func, iterable, chunksize)
264 in a list that is returned.
265 '''
--> 266 return self._map_async(func, iterable, mapstar, chunksize).get()
267
268 def starmap(self, func, iterable, chunksize=None):

~/miniconda3/envs/astroconda/lib/python3.5/multiprocessing/pool.py in get(self, timeout)
642 return self._value
643 else:
--> 644 raise self._value
645
646 def _set(self, i, obj):

AttributeError: 'Source' object has no attribute 'geometries'`

Thanks for the help!
Alicia

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.