Git Product home page Git Product logo

pyneb_devel's People

Contributors

mjchimal avatar morisset 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyneb_devel's Issues

missing deps

When I tried to install I found those missing dependencies on setup:

  • numpy
  • scipy

Emissivity of RecAtom('N',2)

The function associated to n_ii_rec_FSL11.func bugs when:
n2.getEmissivity([1e3, 1e4], 1e4, label='4041.31', product=False)
or
n2.getEmissivity([1e3, 1e4], 1e4, label='4041.31', product=True)

Atmospheric correction in IR

The refraction correction is applied from 2000AA to infinity, implying that IR lines wavelengths are also corrected!
If we want to change this, we will have to change the wl of the line table... But this should be done at some moment, before JWST.

h5py is only an recommended package for astropy

I note that the try-except block in l.3061ff of pyneb_core.py will raise an exception for a install of astropy with only the required packages.

This is because h5py is required by astropy to read hdf-5 files, but it is only a recommended, not a required package.

'_CollDataNone' object has no attribute 'getOmega'

Using the pip-installed version of PyNeb, I get a crash when I try to compute the emissivity of HeII:

import pyneb as pn
atm = pn.Atom('He', 2)
emis = atm.getEmissivity(1e4, 1e2)

~/anaconda3/envs/py39/lib/python3.9/site-packages/pyneb/core/pynebcore.py in getEmissivity(self, tem, den, lev_i, lev_j, wave, product)
   1898             n_den = den.size
   1899             tem_ones = np.ones(n_tem)
-> 1900             populations = self.getPopulations(tem, den, product=True)
   1901             if ((lev_i == -1) and (lev_j == -1)):
   1902                 resultArray = np.zeros((NLevels, NLevels, n_tem, n_den))

~/anaconda3/envs/py39/lib/python3.9/site-packages/pyneb/core/pynebcore.py in getPopulations(self, tem, den, product, NLevels)
   1680             den_ones = np.ones(n_den)
   1681             # q is vector-indexed (q(0, 1) = rate between levels 1 and 2)
-> 1682             q = self.getCollRates(tem, n_level)
   1683             Atem = np.outer(self._A[:n_level, :n_level], tem_ones).reshape(n_level, n_level, n_tem)
   1684             pop_result = np.zeros((n_level, n_tem, n_den))

~/anaconda3/envs/py39/lib/python3.9/site-packages/pyneb/core/pynebcore.py in getCollRates(self, tem, NLevels)
   1479             res_shape.append(sh)
   1480         resultArray = np.zeros(res_shape)
-> 1481         Omegas = self.getOmega(tem)
   1482         for i in range(NLevels - 1):
   1483             lev_i = i + 1

~/anaconda3/envs/py39/lib/python3.9/site-packages/pyneb/core/pynebcore.py in getOmega(self, tem, lev_i, lev_j, wave)
   1416         kappa = config.kappa
   1417         if kappa is None:
-> 1418             to_return = self.CollData.getOmega(tem, lev_i, lev_j)
   1419         else:
   1420             #ToDo The Kappa correction should come AFTER the transformation into CS unit

AttributeError: '_CollDataNone' object has no attribute 'getOmega'

Typo in the documentation

help(pn.Atom.getEmissivity) shows

Help on function getEmissivity in module pyneb.core.pynebcore:

getEmissivity(self, tem, den, lev_i=-1, lev_j=-1, wave=-1, product=True)
    Return the line emissivity (in erg.s-1.cm3) of selected transition or complete array of emissivities
    The transition is selected by the argument wave (if given); 
    if wave is not supplied, it is selected by the upper and lower levels (lev_i and lev_j); 
    if neither is given, the whole array is computed
    
    Usage:      
        O3.getEmissivity(12000, 100, 4, 2)         # (4, 2) transition
        O3.getEmissivity(10000, 10000, wave=5007)  # (4, 2) transition
        O3.getEmissivity(12000, 100)               # all transitions
        O3.getEmissivity([10000, 12000], [100, 500], 4, 2)
        O3.getEmissivity([10000, 12000], [100, 500])
        
    Parameters:
        - tem      electronic temperature in K. May be an array.
        - den      electronic density in cm^-3. May be an array.
        - lev_i    upper level (default= -1)
        - lev_j    lower level (default= -1)
        - wave     wavelength of transition. Takes precedence on lev_i and lev_j if set, 
                    ignored otherwise. It can also be a blend label.
        - product  Boolean. If True (default), all the combination of (tem, den) are used. 
                     If False, tem and den must have the same size and are joined.

I think the unit of emissivity should be erg.s-1.cm-3, so there is a typo or maybe my understanding was wrong.

pn.RecAtom('H', 1, case='A') does not produce case A values.

Hi,

thanks for pyneb. The following

import pyneb as pn
hi_a = pn.RecAtom('H', 1, case='A')
hi_b = pn.RecAtom('H', 1, case='B')
hb_a = hi_a.getEmissivity(1e4,10, label='4_2')
hb_b = hi_b.getEmissivity(1e4,10, label='4_2')
print(hb_a, hb_b)

yields 1.235e-25 1.235e-25

However,

pn.atomicData.setDataFile('h_i_rec_SH95-caseA.fits', 'H1','rec')
hi_a =  pn.RecAtom('H', 1)
print(hi_a.getEmissivity(1e4,10, label='4_2'))

yields 8.245e-26.

But the init signature is:

 pn.RecAtom(elem=None, spec=None, atom=None, case='B', extrapolate=False)

So the case= paraemter is not yet implemented?

Best regards,
Christian

Update atomic data CII

Check the following references:

  • Liang, Badnell & Zhao (2012) A&A 547, A87 (2012) DOI: 10.1051/0004-6361/201220277
  • Tayal, S. S. 2008, A&A, 486, 629

inclusion in the Astropy affiliated package ecosystem

I tried to let PyNeb to be an affiliated astropy package. Some important issues avoid this for the moment. The discussion is there:
astropy/astropy.github.com#332
The 2 main blocking pints are:
Documentation:
At the moment, the user manual is almost exclusively in notebook form, and there is no connection between the manual and the API docs in the reference manual. Ideally, when users read the narrative documentation, it would be good to make sure the method/function/class names in the narrative can link to the API docs so that users can find out more about the available options. For consistency with other packages in the astropy ecosystem, you might want to consider using Sphinx as the primary framework for the docs, which would allow you to have API docs (using e.g. sphinx-automodapi) and which also allows notebooks to be used as-is to generate the docs (using nbsphinx). In this way, all the docs would be on a common site rather than be separated into the reference API docs and the user manual. Aside from the framework, the notebooks could do with more explanatory text. It doesn't look like the documentation is automatically built/tested when changes are made to PyNeb. On the plus side, the mailing list is active and user support there is fast.
Testing
The test coverage, as measured by pytest pyneb --cov pyneb, is around 21%, which is very low - it would need to be significantly higher for the package to be accepted. In addition, we would highly recommend setting up a CI service (Travis, AppVeyor, CircleCI, Azure Pipelines, etc.) to run the tests any time a change is made to the repository.

Will try to find time to solve these issues.

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.