chianti-atomic / ChiantiPy

ChiantiPy is a python package to calculate the radiative properties of astrophysical plasmas based on the CHIANTI atomic database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mspectrum raises NotImplementedError on macOS

opened this issue · comments

When calling mspectrum() on macOS (10.12.6, python3.6) the NotImplementedError is raised.
It seems to be a multiprocessing module dependent error, since calling the qsize() method might fail under macOS.

NotImplementedError                       Traceback (most recent call last)
<timed exec> in <module>()

/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ChiantiPy-0.7.dev534-py3.6.egg/ChiantiPy/core/Mspectrum.py in __init__(self, temperature, eDensity, wavelength, filter, label, elementList, ionList, minAbund, keepIons, abundance, doContinuum, allLines, em, proc, verbose, timeout)
    162                 ionWorkerQ.put((akey, temperature, eDensity, wavelength, filter, allLines, abundance, em, doContinuum))
    163         #
--> 164         ffWorkerQSize = ffWorkerQ.qsize()
    165         fbWorkerQSize = fbWorkerQ.qsize()
    166         ionWorkerQSize = ionWorkerQ.qsize()

/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/queues.py in qsize(self)
    115     def qsize(self):
    116         # Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
--> 117         return self._maxsize - self._sem._semlock._get_value()
    118 
    119     def empty(self):

NotImplementedError: 

This is another sign of some of the problems with the continuum routines as in issue #155 and I am working to correct them. In the meantime, there is the v 0.7.0 release that works but the continuum calculations are not as good as in the current version, when I get it working again.

I wonder if this is fixed by #157 as well? The source of this error is much less obvious to me...
See comment below

@Astroprog could post the exact code snippet that led to this error?

@kdere I'm pretty sure this is just a consequence of executing the qsize() method on Mac OS as indicted by the comment in the Traceback,

# Raises NotImplementedError on Mac OSX because of broken sem_getvalue()

The only option I think would be to find a different way of getting the queue size, at least on OS X. There is a similar issue here: vterron/lemon#11

Try running the calculation without calculating the continuum. The spectral line intensities calculations have not changed and this may tell us something

I just did this myself and the calculation worked for me.
temp=2.e+7 dens=1.e+9 wvl=1. + 0.002*arange(4501) import ChiantiPy.tools.filters as chfilters s3 = ch.spectrum(temp, dens, wvl, filter = (chfilters.gaussian,.015),doContinuum=0, em=1.e+27,minAbund=1.e-5,verbose=1,nproc=4)
because I was only working with the line intensities, neither ffworkerQ nor fbworkerQ are used. I suspect that is has not been tested this way. I think I have always calculated the ions and may or may not have calculated the continuum. I will try this once the continuum code gets working again.