Code Monkey home page Code Monkey logo

pandexo's Introduction




Getting Started

Tools to help the community with planning exoplanet observations.

PandExo is both an online tool and a python package for generating instrument simulations of JWST’s NIRSpec, NIRCam, NIRISS and NIRCam and HST WFC3. It uses throughput calculations from STScI’s Exposure Time Calculator, Pandeia: Pandeia + Exoplanets = PandExo. This documentation contains information on how to download, install and analyze PandExo output.

Should I install PandExo or use the online interface?

Install if...

  • I will be using PandExo for more than 10 runs
  • I want to submit bash runs
  • I want to use the online GUI but don't want to be subject to any slow downs because of high user frequency
  • I want to be able to use plotting functions to analyze my output

Install EVEN if...

  • I am scared of Python

Do not install if...

  • I will only be using PandExo fewer than 10 times

Requires

image

image

pandexo's People

Contributors

aarynncarter avatar eas342 avatar exowanderer avatar ideasrule avatar lheinke avatar mfixstsci avatar natashabatalha avatar nespinoza avatar pcubillos avatar yifzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandexo's Issues

Handling missing values when loading system parameters from exo.MAST

We already discussed this issue, but I'm putting in writing...

PandExo breaks when retrieving parameters for some planetary systems. This happens because some exo.MAST fields are empty.

A reasonable solution might be to have a "Resolve Target" button that, when clicked, retrieves the system parameters from exo.MAST, reloads the page, and populates fields for which there is information. I don't know how to implement this, but we do something similar in ExoCTK.

[Feature request] Load stellar spectrum as dict

Hi,
The exo_dict dictionary argument of the jdi.run_pandexo(exo_dict, ...) function allows the user to pass a user-defined stellar spectrum as a filename. It would be great if the user could pass a custom stellar spectrum as a dict (removing the need to write/read to/from file).

This can be accomplish by modifying the following lines in the outTrans() function in cretate_input.py:

    if input['type'] == 'user':
        if isinstance(input['starpath'], dict):
            star = input['starpath']
        else: #if isinstance(input['starpath'], str):
            star = np.genfromtxt(input['starpath'], dtype=(float, float), names='w, f')

From the user point of view, he/she would need to set up things like this:

    exo_dict = jdi.load_exo_dict()
    # ...
    starflux = {'f':flux_array, 'w':wavelength_array}
    exo_dict['star']['type'] = 'user'
    exo_dict['star']['starpath'] = starflux
    # ...

How does this sound? If you agree, I can put a pull request.
Thanks.

Index 0 is out of bounds for axis 0 with size 0

Hi,

image

And please the full error below.

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/tmp/ipykernel_54690/2918580075.py in <module>
    109 #personalize subarray
    110 #inst_dict["configuration"]["detector"]["subarray"] = 'sub512'
--> 111 result = jdi.run_pandexo(exo_dict, inst_dict)
    112 
    113 np.mean(result['FinalSpectrum']['spectrum_w_rand'])

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/justdoit.py in run_pandexo(exo, inst, param_space, param_range, save_file, output_path, output_file, num_cores, verbose)
    377     if type(inst) == dict:
    378         if verbose: print("Running Single Case w/ User Instrument Dict")
--> 379         results =wrapper({"pandeia_input": inst , "pandexo_input":exo}, verbose=verbose)
    380         if output_file == '':
    381             output_file = 'singlerun.p'

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/pandexo.py in wrapper(dictinput, verbose)
     34     if telescope=='jwst':
     35         from .jwst import compute_full_sim
---> 36         return compute_full_sim(dictinput, verbose=verbose)
     37     elif telescope=='hst':
     38         from .hst import compute_sim_hst

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/jwst.py in compute_full_sim(dictinput, verbose)
    121     star_spec = create.outTrans(pandexo_input['star'])
    122     #get rstar if user calling from grid
--> 123     both_spec = create.bothTrans(star_spec, pandexo_input['planet'], star=pandexo_input['star'])
    124     out_spectrum = np.array([both_spec['wave'], both_spec['flux_out_trans']])
    125 

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/create_input.py in bothTrans(out_trans, planet, star)
    253                            & (header.noTiO==planet['noTiO']) & (header.ray==planet['ray']) &
    254                            (header.flat==planet['flat'])]
--> 255         wave_planet=np.array(pd.read_sql_table(df['name'].values[0],db)['wavelength'])[::-1]
    256 
    257         r_lambda=np.array(pd.read_sql_table(df['name'].values[0],db)['radius'])*u.km

IndexError: index 0 is out of bounds for axis 0 with size 0

spectral sampling

Hi,
I was looking at the example at https://natashabatalha.github.io/PandExo/tutorialjwst.html and noted that when I print out:

# ...
R_in = 100.0
x, y, e = jpi.jwst_1d_spec(out, R=R_in, num_tran=10, model=False, x_range=[0.8, 1.28])

wl = x[0]
R_out = wl[1:]/np.ediff1d(wl)
print(R_out)

I get numbers close to R_out ~ 2*R_in. Is this intended?, I would have expected to get R_out~R_in. In any case, I think it might be a good idea to document what the code means by R.

Clarify pandeia data version in `pandexo.sh`?

The pandexo.sh looks to be expecting a file called pandeia_data-1.1.1.tar for the pandeia data. However, the most recent pandeia data for download, as linked to on the docs has a newer version (pandeia_data-1.2.tar). Perhaps you could update the install script, and also ensure that 1.2 is the version we should be using? Thanks!

run_test.py fails with python 3.8.5

After installing pandexo with python 3.8.5, the following errors appear in ubuntu linux

python run_test.py
Downloading https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
|========================================================================================================================================================================| 1.3k/1.3k (100.00%) 0s
Starting TEST run
Running Single Case for: NIRSpec G140H
Traceback (most recent call last):
File "/mnt/d/Pandexo-master/pandexo/engine/jwst.py", line 79, in compute_full_sim
i = InstrumentFactory(config=conf)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 62, in init
JWSTInstrument.init(self, mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 32, in init
telescope = JWST()
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/config.py", line 47, in init
all_config = merge_data(self._get_config(), config, dict(**kwargs))
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/telescope.py", line 33, in _get_config
self.ref_dir = os.path.join(default_refdata_directory, self.tel_name, "telescope")
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_test.py", line 30, in
jdi.run_pandexo(exo_dict, ['NIRSpec G140H'], save_file=False)
File "/mnt/d/Pandexo-master/pandexo/engine/justdoit.py", line 402, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo}, verbose=verbose)
File "/mnt/d/Pandexo-master/pandexo/engine/pandexo.py", line 36, in wrapper
return compute_full_sim(dictinput, verbose=verbose)
File "/mnt/d/Pandexo-master/pandexo/engine/jwst.py", line 85, in compute_full_sim
i = InstrumentFactory(config=conf_temp)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 62, in init
JWSTInstrument.init(self, mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/jwst.py", line 32, in init
telescope = JWST()
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/config.py", line 47, in init
all_config = merge_data(self._get_config(), config, dict(**kwargs))
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/site-packages/pandeia.engine-1.6-py3.8.egg/pandeia/engine/telescope.py", line 33, in _get_config
self.ref_dir = os.path.join(default_refdata_directory, self.tel_name, "telescope")
File "/home/siegfried/anaconda3/envs/science/lib/python3.8/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Most likely an issue with upgrading to the latest python version(s).

Unable to call jdi.run_pandexo()

Hi, Can someone please help me out.

If I call run_pandexo() using instrument type as string, I get the below error:

result = jdi.run_pandexo(exo_dict, "NIRSpec Prism")

Instrument input is not dict so must be list. Enter in format ["NIRSpec G140M"] or ["NIRISS SOSS","MIRI LRS"]

If I give it as array, I get this following error:

result = jdi.run_pandexo(exo_dict, ["NIRSpec Prism"])

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_20806/893901556.py in <module>
----> 1 result = jdi.run_pandexo(exo_dict,["NIRSpec Prism"])

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/justdoit.py in run_pandexo(exo, inst, param_space, param_range, save_file, output_path, output_file, num_cores, verbose)
    400             if verbose: print("Running Single Case for: " + inst[0])
    401             inst_dict = load_mode_dict(inst[0])
--> 402             results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo}, verbose=verbose)
    403             if output_file == '':
    404                 output_file = 'singlerun.p'

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/pandexo.py in wrapper(dictinput, verbose)
     34     if telescope=='jwst':
     35         from .jwst import compute_full_sim
---> 36         return compute_full_sim(dictinput, verbose=verbose)
     37     elif telescope=='hst':
     38         from .hst import compute_sim_hst

~/anaconda3/lib/python3.8/site-packages/pandexo/engine/jwst.py in compute_full_sim(dictinput, verbose)
     83 
     84 
---> 85     i = InstrumentFactory(config=conf_temp)
     86 
     87     #detector parameters

~/anaconda3/lib/python3.8/site-packages/pandeia/engine/instrument_factory.py in InstrumentFactory(config, webapp, **kwargs)
     48         raise EngineInputError(value=msg)
     49     else:
---> 50         cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
     51         return cls

~/anaconda3/lib/python3.8/site-packages/pandeia/engine/jwst.py in __init__(self, mode, config, webapp, **kwargs)
     68         config['detector']['max_total_groups'] = config['detector']['nint'] * config['detector']['ngroup']
     69 
---> 70         JWSTInstrument.__init__(self, mode=mode, config=config, webapp=webapp, **kwargs)
     71 
     72         slit = self.instrument.get('slit',None)

~/anaconda3/lib/python3.8/site-packages/pandeia/engine/jwst.py in __init__(self, mode, config, webapp, **kwargs)
     31 
     32     def __init__(self, mode=None, config={}, webapp=False, **kwargs):
---> 33         telescope = JWST()
     34         # these are the required sections and need to be passed via API in webapp mode
     35         self.instrument_pars = {}

~/anaconda3/lib/python3.8/site-packages/pandeia/engine/config.py in __init__(self, config, webapp, **kwargs)
     45         # grab info from the configured defaults file, if any, from caller via a passed dict, or via keywords
     46         # clean meta blocks from the configuration files
---> 47         all_config = merge_data(self._get_config(), config, dict(**kwargs))
     48         # checking if all_config matches self._get_config() is preferable, because it handles both the case where
     49         # config={} was either empty and where it had just a single entry equivalent to the default.

~/anaconda3/lib/python3.8/site-packages/pandeia/engine/telescope.py in _get_config(self)
     31         # use this trick to key the configuration file name off the name of the instantiated subclass
     32         self.tel_name = self.__class__.__name__.lower()
---> 33         self.ref_dir = os.path.join(default_refdata_directory, self.tel_name, "telescope")
     34         config = io.read_json(os.path.join(self.ref_dir, "config.json"), raise_except=True)
     35         # add separate CR config, if it's there...

~/anaconda3/lib/python3.8/posixpath.py in join(a, *p)
     74     will be discarded.  An empty last part will result in a path that
     75     ends with a separator."""
---> 76     a = os.fspath(a)
     77     sep = _get_sep(a)
     78     path = a

TypeError: expected str, bytes or os.PathLike object, not NoneType```


key error sed families

when I am running the python code example 'run_test.py' I get and error KeyError: 'sed_families' with a version of pandexo recently downloaded. The same happens when using the interface.

When running the interface or the installed version using my own spectra and python code I get the same error if I am choosing the JWST MIRI mode. If I choose the NIRCam instrument, an error occurs concerning the bots files.

Thank you for looking into this.

"KeyError: 'calculateRamp'" in hst.py

Hello!

When running jdi.run_pandexo() with all instruments, or specifically with WFC3 G141, a KeyError returns.

Appears that in line 652 of hst.py, calRamp = pandeia_input['strategy']['calculateRamp'], the key 'calculateRamp' doesn't exist. Running the run_test.py script with the 'RUN ALL' option reproduces the error. Not sure if I should be adjusting something for HST/WFC use, but I couldn't find anything.

Thank you!

Inconsistent binning output

I discovered that the output of the binning functionality is somewhat inconsistent. I have described the issue in pull request #62 and proposed some changes to fix the issue.

Setting path for Fortney Grid File

I tried to run JWST_Running_Pandexo.ipynb and had the following issue:

Exception: Fortney Grid File Path is incorrect, or not initialized

How do I set that up?

Thanks,
Ji

"ValueError: min() arg is an empty sequence" in create_input.py

When running result = jdi.run_pandexo() I will get an error about once every thousand individual runs:

wavemin = max([min(wave_planet), min(wave_star), 0.5]) ValueError: min() arg is an empty sequence from the /pandexo/engine/create_input.py file. This doesn't seem to repeat on the same inputted data set and parameters but will rather pop up at random increments for any random data set and parameter input within the loop. I'm not sure if this is something anyone else has run into but I can't seem to diagnose the issue since it seems to be randomly occurring.

Updating to Astropy-3

During the installation process, PandExo suggests Astropy-2, instead of Astropy-3. This is because Pandeia on the backend requires Astropy==2.0.2.

When it comes to using PandExo with Pandeia, the sub-package that requires Astropy-2 is astropy.analytic_functions -- because Pandeia uses import astropy.analytic_functions.blacbody_nu. Astropy-3 now places the blackbody_nu inside astro.modeling.blackbody, instead of astropy.analytic_functions.

If Pandeia were to edit the file sed.py in $HOME/anaconda3/lib/python3.6/site-packages/pandeia/engine/sed.py and change the import on line 8, from

from astropy.analytic_functions import blackbody_nu

to

from astropy.modeling.blackbody import blackbody_nu

Then PandExo (and maybe Pandeia) could use Astropy-3, which is now default for the community.

It might be useful to add a suggestion during the install, or in the documentation, for moderate-to-advanced users to edit this one line in Pandeia, in order to update Pandeia and PandExo to Astropy-3.

Full solution:

open $HOME/anaconda3/lib/python3.6/site-packages/pandeia/engine/sed.py

On line 8, comment out

from astropy.analytic_functions import blackbody_nu

and add

from astropy.modeling.blackbody import blackbody_nu

Incorporate NIRISS Order 2 in PandExo online

Hi @natashabatalha,

Either of us can take this on, but wanted to leave it here for future reference. Currently, PandExo online can't do NIRISS/SOSS Order 2 simulations --- but of course on a locally-installed version one can via instrument_dictionary['strategy']['order'] = 2. Need to implement this option in the online version, too.

I'm a bit thorn as to what the best strategy would be:

  • Easiest would be to add an extra option below "Instrument" whenever NIRISS is selected, on which one could select the Order. This is the most straightforward because it would be a simple "if" statement in the online codebase. This "dynamic menus" after selecting an instrument is already incorporated in the code.
  • More complex would be to add results of both orders in the final results. This would be more complicated because it would imply running two simulations, but also because on the final results page it would imply creating some extra space for the two orders.

Leaving it here for implementation for the next Cycle; cc: @mfixstsci.

N.

Cannot import name 'blackbody'

When calling result = jdi.run_pandexo..., the following error is thrown:

/home/exolab/anaconda3/lib/python3.9/site-packages/pandexo.engine-1.5.3.1-py3.9.egg/pandexo/engine/create_input.py in module
6 import astropy.constants as c
7 import os
----> 8 from astropy.modeling import blackbody as bb
9 import warnings
10 with warnings.catch_warnings():

ImportError: cannot import name 'blackbody' from 'astropy.modeling' (/home/exolab/anaconda3/lib/python3.9/site-packages/astropy/modeling/init.py)

This seems to be because astropy deprecated their old 'blackbody' module:
https://docs.astropy.org/en/stable/changelog.html?highlight=blackbody_nu#id288

KeyError when running NIRSpec

I am getting the following error when running NIRSpec with any filter:
"Unknown key format {} value {} listed in {}".format(kfe, value_lookup[kfe],
KeyError: 'readmode'

I have updated pandeia and pandexo, but from what I can tell 'readmode' is not listed anywhere in instrument.py. Could this be the problem?

Failure with NoneType data in parameter list

(pandexo) mac-525:PandExo freddy$ python run_test.py
Starting TEST run
Running Single Case for: NIRSpec G140H
Traceback (most recent call last):
File "run_test.py", line 30, in
jdi.run_pandexo(exo_dict, ['NIRSpec G140H'], save_file=False)
File "/Users/freddy/ownCloud/Software/GitHub/PandExo/pandexo/engine/justdoit.py", line 269, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo})
File "/Users/freddy/ownCloud/Software/GitHub/PandExo/pandexo/engine/pandexo.py", line 33, in wrapper
return compute_full_sim(dictinput)
File "/Users/freddy/ownCloud/Software/GitHub/PandExo/pandexo/engine/jwst.py", line 83, in compute_full_sim
i = InstrumentFactory(config=conf_temp)
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/site-packages/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/site-packages/pandeia/engine/jwst.py", line 62, in init
JWSTInstrument.init(self, mode=mode, config=config, webapp=webapp, **kwargs)
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/site-packages/pandeia/engine/jwst.py", line 32, in init
telescope = JWST()
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/site-packages/pandeia/engine/config.py", line 46, in init
all_config = merge_data(self._get_config(), config, dict(**kwargs))
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/site-packages/pandeia/engine/telescope.py", line 33, in _get_config
self.ref_dir = os.path.join(default_refdata_directory, self.tel_name, "telescope")
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/posixpath.py", line 89, in join
genericpath._check_arg_types('join', a, *p)
File "/Users/freddy/anaconda3/envs/pandexo/lib/python3.5/genericpath.py", line 143, in _check_arg_types
(funcname, s.class.name)) from None
TypeError: join() argument must be str or bytes, not 'NoneType'

New PandExo online version unable to load planet grid if "Resolve target" is used

Hi folks,

Leaving this here for completeness as I've already contacted @natashabatalha internally about this, and @mfixstsci is working on this: when doing "Resolve target" in the new PandExo online version (e.g., https://exoctk.stsci.edu/pandexo/calculation/new), one can try simulations with constant models and uploaded models, but when clicking "Select from Grid" on the "Planet model", the "Temperature" menu states "NO GRID DB FOUND".

Given this problem doesn't appear if one doesn't click on the "Resolve target" button, it is very likely this is a form validation issue.

Thanks in advance @mfixstsci for working on this!
Néstor

Deprecation of astropy.extern.six in Astropy 4.0

When running PandExo with the latest version of Astropy, module import errors of the kind ModuleNotFoundError: No module named 'astropy.extern.six' in astroquery prevent the execution of PandExo.

This can be fixed by altering all import statements that use import astropy.extern.six into import six. There are on the order of 10 such occurrences. Although this is not an issue internal to PandExo, with the upcoming JWST deadline, a warning in the documentation might be useful.

KeyError 'sed_families' in run_test.py

When running the run_test.py, I get an error in the pandeia/engine/sed.py :

File "/mypathtozecode/python3.7/site-packages/pandeia/engine/sed.py", line 88, in _get_config del config[k] KeyError: 'sed_families'

I've downloaded the code through pip, did the pip --upgrade for both pandeia and pandexo and i have astropy 4.2.1, to avoid the issue #66

Any clue what's going on ?
Thanks

Installation fail on macOS Monterey (12.6)

I create a new conda environment and follow the installation instructions from the pandexo website. conda config --add channels http://ssb.stsci.edu/astroconda and conda install pyfftw work fine. pip install pandexo.engine crashes with an error while installing numpy:

image

It seems to be a version incompatibility issue:

image

Incompatibility with pandeia.engine version 1.5.1

The current version of pandeia reference data (v 1.5.1) is incompatible with the current version of PandExo. The PandExo installation page redirects the user to https://pypi.org/project/pandeia.engine, wherein the dependent package pandeia.engine is said to be installed via

$ pip install pandeia.engine

This results in an incompatibility with PandExo and a failure of its test script "run_test.py". Myself, along with another independent tester, have confirmed that this can be mitigated by 1) installing PandExo as per its installation instructions and 2) installing a specific (older) version of pandeia via

$ pip install pandeia.engine==1.4.0

We hope that this will save future users some of our heartache.

pandeia data 1.6 required

During an installation of PandExo from cloning this GitHub repository, we encountered an error when running 'run_test.py'. The error references a missing key for NIRSpec BOTS.

This issue appears to be caused by a mismatch between pandeia.engine==1.6 in setup.py and the pandeia reference data V1.5 linked to in the documentation. We fixed the error by updating the pandeia reference data from V1.5 to 1.6.

Please can you update the documentation to link to V1.6 of the pandeia reference data (https://stsci.app.box.com/v/pandeia-refdata-v1p6)?

Thanks!

Default sat level

In exo_input.json, the default saturation level is listed as " `in % sat level' ", which throws an exception whenever saturation level has not been defined. instead, the default should be some reasonable value (10%, 50%, 80%) so that the code runs.

run_test.py issue: RuntimeError: unsupported data type

Hi,

I am new and ran into the following issue when running run_test.py. Any ideas?

(pandexo) dapangs-MacBook-Air:Downloads dapang182$ python run_test.py
Starting TEST run
Running Single Case for: NIRSpec G140H
Optimization Reqested: Computing Duty Cycle
Traceback (most recent call last):
File "run_test.py", line 30, in
jdi.run_pandexo(exo_dict, ['NIRSpec G140H'], save_file=False)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandexo/engine/justdoit.py", line 326, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo})
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandexo/engine/pandexo.py", line 33, in wrapper
return compute_full_sim(dictinput)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandexo/engine/jwst.py", line 154, in compute_full_sim
m = {"maxexptime_per_int":compute_maxexptime_per_int(pandeia_input, sat_level) ,
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandexo/engine/jwst.py", line 341, in compute_maxexptime_per_int
report = perform_calculation(pandeia_input, dict_report=False)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandeia/engine/perform_calculation.py", line 39, in perform_calculation
report = calculate_sn(calc_input, webapp=webapp)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandeia/engine/etc3D.py", line 1383, in calculate_sn
my_detector_signal = DetectorSignal(o, calc_config=calc_config, webapp=webapp, order=None)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandeia/engine/etc3D.py", line 118, in init
slice_rate = self.all_rates(flux_cube, add_extended_background=False)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandeia/engine/etc3D.py", line 392, in all_rates
fp_pix_rate_ipc = self.ipc_convolve(fp_pix_rate, kernel)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/pandeia/engine/etc3D.py", line 719, in ipc_convolve
fp_pix_ipc = sg.fftconvolve(rate, kernel, mode='same')
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/scipy/signal/signaltools.py", line 542, in fftconvolve
ret = _freq_domain_conv(in1, in2, axes, shape, calc_fast_len=True)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/scipy/signal/signaltools.py", line 383, in _freq_domain_conv
sp2 = fft(in2, fshape, axes=axes)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/scipy/fft/_backend.py", line 23, in ua_function
return fn(*args, **kwargs)
File "/usr/local/anaconda3/anaconda/envs/pandexo/lib/python3.6/site-packages/scipy/fft/_pocketfft/basic.py", line 186, in r2cn
return pfft.r2c(tmp, axes, forward, norm, None, workers)
RuntimeError: unsupported data type

Thanks,
Ji

`jdi.run_pandexo` not reading input instrument dictionary

image

I'm trying to generate a MIRI LRS trace after just 1 exposure, but it seems like it's running the default parameters, not the instrument dictionary `inst_dict` I'm feeding it.

I proved this by comparing my results when running the default setting of 10 exposures, and compared the 2 arrays. In this cell I took a np.mean() of both arrays for quick comparison.
image

syntax error when running newest version 1.1.0

I just upgraded to the new version following @natashabatalha 's announcement that it should be more efficient for bright targets. When I try to run a calculation I get a syntax error:

Traceback (most recent call last):
File "./simulate_obs", line 67, in
res = do_sim(args.model, inst, **kwarg_dict)
File "./simulate_obs", line 34, in do_sim
res = jdi.run_pandexo(exo_dict,[inst])
File "/Users/aigrain/anaconda/lib/python2.7/site-packages/pandexo/engine/justdoit.py", line 269, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo})
File "/Users/aigrain/anaconda/lib/python2.7/site-packages/pandexo/engine/pandexo.py", line 32, in wrapper
from .jwst import compute_full_sim
File "/Users/aigrain/anaconda/lib/python2.7/site-packages/pandexo/engine/jwst.py", line 156
print("Finished Duty Cycle Calc", print(m["maxexptime_per_int"]))

Easily fixed (done it on my local version) but I thought I'd bring it up

Wavelength sampling - NIRSpec G395H

Hi!

I have found a strange thing that might be a small bug in Pandexo.

My simulations are for one transit with NIRSpec G395H. The issue is: There are way too many points between wavelengths 5.097 and 5.1 microns.

I ran simulations for several planets and input spectra, they all have that issue. The input spectra I use do not have that. The issue appears in the spectrum resampled by Pandexo, then propagates to the final Pandexo output.

I attach one example, for HAT-P-11b, with:

  • input model spectrum (met_office_um_transmission_spectrum_hatp11b_equilibrium.txt)
  • spectrum resampled by Pandexo (met_office_um_transmission_spectrum_hatp11b_equilibrium_resampled.txt)
  • Pandexo simulated spectrum (met_office_um_transmission_spectrum_hatp11b_equilibrium_pandexo.txt)
  • plot of the wavelength in the resampled and simulated Pandexo spectra (plot-wavelengths.png). The jump at index 1270 is the detector gap, so it's fine, but the flat part between index 3200 and 3900 that is stuck around 5.1 is weird. Indeed in the txt files there are many many lines between 5.097 and 5.1 microns.

I have this issue for the current Pandexo version, and it was already there in the previous version I used, which dates back from February last year.

I found it for G395H but I have not checked for any other NIR modes.

It's not urgent, it affects the result only in a very small fraction of the spectrum.

Do you also see that issue? If not, it may come from my side...

Best,
Nicolas Crouzet

met_office_um_transmission_spectrum_hatp11b_equilibrium.txt
met_office_um_transmission_spectrum_hatp11b_equilibrium_resampled.txt
met_office_um_transmission_spectrum_hatp11b_equilibrium_pandexo.txt
plot-wavelengths

wbin: error when binning

In jwst.py, the line "wbin = wbin[photon_out_bin > 0 ]" throws the error "TypeError: only integer scalar arrays can be converted to a scalar index" because bin_wave_to_R returns a list (not a NumPy array). Either that functions output should always be cast to type array on return, or the offending line above should be changed to: "wbin = np.array(wbin)[photon_out_bin > 0 ]"

Thanks for making these great tools publicly available.

RuntimeError: unsupported data type

Hi Natasha, I've been trying to install pandexo using the instructions on the github and it doesn't seem to be working. I've run into this error:
Starting TEST run
Running Single Case for: NIRSpec G140H
Optimization Reqested: Computing Duty Cycle
Traceback (most recent call last):
File "run_test.py", line 30, in
jdi.run_pandexo(exo_dict, ['NIRSpec G140H'], save_file=False)
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/justdoit.py", line 326, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo})
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/pandexo.py", line 33, in wrapper
return compute_full_sim(dictinput)
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/jwst.py", line 154, in compute_full_sim
m = {"maxexptime_per_int":compute_maxexptime_per_int(pandeia_input, sat_level) ,
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/jwst.py", line 341, in compute_maxexptime_per_int
report = perform_calculation(pandeia_input, dict_report=False)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/pandeia/engine/perform_calculation.py", line 39, in perform_calculation
report = calculate_sn(calc_input, webapp=webapp)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/pandeia/engine/etc3D.py", line 1383, in calculate_sn
my_detector_signal = DetectorSignal(o, calc_config=calc_config, webapp=webapp, order=None)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/pandeia/engine/etc3D.py", line 118, in init
slice_rate = self.all_rates(flux_cube, add_extended_background=False)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/pandeia/engine/etc3D.py", line 392, in all_rates
fp_pix_rate_ipc = self.ipc_convolve(fp_pix_rate, kernel)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/pandeia/engine/etc3D.py", line 719, in ipc_convolve
fp_pix_ipc = sg.fftconvolve(rate, kernel, mode='same')
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/scipy/signal/signaltools.py", line 542, in fftconvolve
ret = _freq_domain_conv(in1, in2, axes, shape, calc_fast_len=True)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/scipy/signal/signaltools.py", line 383, in _freq_domain_conv
sp2 = fft(in2, fshape, axes=axes)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/scipy/fft/_backend.py", line 23, in ua_function
return fn(*args, **kwargs)
File "/home/jaketaylor/anaconda3/envs/pandexo2/lib/python3.7/site-packages/scipy/fft/_pocketfft/basic.py", line 186, in r2cn
return pfft.r2c(tmp, axes, forward, norm, None, workers)
RuntimeError: unsupported data type

I'm using pandeia_data-1.4. I've also tried pandeia_data-1.5 and that also didn't work. I upgraded pandeia.engine to version 1.5 but this isn't compatible with pandexo.engine version 1.4 and so that falls over too with this error:
Starting TEST run
Running Single Case for: NIRSpec G140H
Traceback (most recent call last):
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/jwst.py", line 77, in compute_full_sim
i = InstrumentFactory(config=conf)
File "/home/jaketaylor/anaconda3/envs/pandexo3/lib/python3.7/site-packages/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/jaketaylor/anaconda3/envs/pandexo3/lib/python3.7/site-packages/pandeia/engine/jwst.py", line 59, in init
self.detector_readout_pattern = config['detector']['readout_pattern']
KeyError: 'readout_pattern'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_test.py", line 30, in
jdi.run_pandexo(exo_dict, ['NIRSpec G140H'], save_file=False)
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/justdoit.py", line 326, in run_pandexo
results =wrapper({"pandeia_input": inst_dict , "pandexo_input":exo})
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/pandexo.py", line 33, in wrapper
return compute_full_sim(dictinput)
File "/network/group/aopp/planetary/PGJI007_TAYLOR_EXOSIM/pandexo/pandexo/engine/jwst.py", line 83, in compute_full_sim
i = InstrumentFactory(config=conf_temp)
File "/home/jaketaylor/anaconda3/envs/pandexo3/lib/python3.7/site-packages/pandeia/engine/instrument_factory.py", line 50, in InstrumentFactory
cls = inst_map[instrument](mode=mode, config=config, webapp=webapp, **kwargs)
File "/home/jaketaylor/anaconda3/envs/pandexo3/lib/python3.7/site-packages/pandeia/engine/jwst.py", line 59, in init
self.detector_readout_pattern = config['detector']['readout_pattern']
KeyError: 'readout_pattern'

I was wondering if you had any ideas on how to fix this?
Thanks!

Make Saturation Warnings more obvious for users

In the python interface, users have to manually check output['warings'] dictionary key to see if they have saturated pixels. Hard saturated pixels need to be more directly obvious. This can be accomplished through:

  • user warnings
  • printouts in verbose=True mode
  • colored pixels in jpi.jwst_1d_spec

In the meantime, users should be in the habit of checking their output. E.g.

exo = jdi.load_exo_dict('LTT-1445 A b')
exo['observation']['sat_level']=80
exo['observation']['sat_unit']='%'
exo['planet']['type']='constant'
exo['planet']['f_unit']='rp^2/r*^2'
output = jdi.run_pandexo(exo, ['NIRSpec Prism'])

Gives the warnings:

>>> output['warning']
{'Group Number Too Low?': 'All good', 
'Group Number Too High?': 'All good', 
'Non linear?': 'All good', 'Saturated?': 
'Full saturation:\n There are 644 pixels saturated at the end of the first group. These pixels cannot be recovered.', 
'% full well high?': 'All good', 
'Num Groups Reset?': 'NGROUPS<2SET TO NGROUPS=2'}

Which shows the user it is saturated.

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.