Closed DavidSpenceUAH closed 1 year ago
Dear David,
Thank you for reporting this error. I have not seen this specific error before. But since it mentions OMP, it is likely an error in the parallel processing. In SPEX, most of the parallelisation is arranged by the Intel Fortran compiler, which explains the Intel URL in the error message.
Could you try switching OMP off and see if the error persists? You can change the number of used cores/threads by setting the following environment variable in the terminal (before starting python) like this:
In bash:
export OMP_NUM_THREADS=1
In csh:
setenv OMP_NUM_THREADS 1
After setting this variable, the number of cores while running SPEX/PYSPEX should be limited to 1, which effectively switches OMP off. Does the error still occur after setting this variable?
A second probable cause that I can think of is somehow a conflict between the Intel Math Kernel Library (MKL) from pyspex and the one in conda. Sometimes the MKL in conda can indeed lead to issues. The solution would then be to install the 'nomkl' package in conda:
conda install nomkl
Conda then installs versions of, for example, numpy that do not depend on MKL.
Plot adum
Unfortunately, there is no direct equivalent of 'plot adum' in pyspex, but this is a good idea and I will add this to our to-do list for the upcoming release. The reason that this function is not there, is that there are other ways in Python to either change the plot or get access to the plotted data. If this is not what you like, you can still access the SPEX commands for QDP output. Let me list a number of alternatives:
If you want to change the looks of the plot, then the s.plot_data()
command can be set such that the matplotlib object is returned. You can then change the plot using matplotlib functions before showing the plot, for example adding a custom title:
(pldata, plt) = s.plot_data(show=False)
plt.title("This is my plot")
plt.show()
If you want access to the data of the plot, then s.plot_data()
can also return an object with all the data in it. The command is the same as above. The data can be found in the pldata
variable:
(pldata, plt) = s.plot_data(show=False)
dir(pldata)
Due to the way things are organised in SPEX, the data is nested according to instrument number and region number, so to access the data of the plot, you need to go two levels deep:
print(pldata.inst[0].reg[0].pdata)
The pdata
variable contains the count rate. The other parameter names with short explanation are described on this help page:
The SPEX commands are still available in pyspex through s.command()
. However, you need to set the plot type again in the SPEX way:
s.command("plot dev null")
s.command("plot type data")
s.command("plot adum plotqdp")
Which will return a QDP file with the data for you.
I hope these answers work for you, but I agree a convenience function for the above would be helpful!
Thank you so much for your quick response from both myself, and Dr. Bonamente, who is my PhD advisor and mentioned having a correspondence with you! You have been extremely helpful, and both my issues seem to be solved here. Switching off OMP didn't have an effect on the error, but having conda install nomkl seems to have done the trick! PYSPEX seems to be working perfectly now and plotting works very well. I also tried several of the solutions you've given as a substitute for the "adum" command, and they all seemed to work as desired too.
I'm not sure if I should make another post asking this or not, but the only issue I seem to be having now is that I'm unaware of how to change the unit of the axes in PYSPEX. Using commands such as s.use()
or s.ignore()
with the unit argument: s.use(1,1, 20,35, 'ang')
do work, but when it comes to actually plotting the spectrum I haven't found a way to do something similar to plot ux a
that would be done in normal SPEX. As of right now, I'm stuck in units of KeV on the axes of the plot. I've also tried s.command("plot ux a")
and various combinations of this but they dont seem to have an effect on the actual plot.
Besides this though, everything is working great. Thank you for your help and thorough response, it is greatly appreciated!
You are welcome! I am glad that you were able to solve the problem. Give my regards to dr. Bonamente!
Regarding plotting in Angstrom, I unfortunately did not have the time to implement that yet. It's on my list for the next release. In that respect, pyspex is still a bit in an experimental stage and not all functionality is there yet. I hope you can enjoy the parts that are functional!
The reply is a bit late, but wavelength plotting in pyspex is available since SPEX 3.07.00.
I am having an issue with plotting using pyspex currently. It seems that every other command I've tried works and runs properly, but when running s.plot_data(), I receive an error code and the session crashes. Currently I have
Whenever I include the "s.plot_data()" command in my code, I'm given this error:
OMP: Error #13: Assertion failure at z_Linux_util.cpp(2338). OMP: Hint Please submit a bug report with this message, compile and run commands used, and machine configuration info including native compiler and operating system versions. Faster response will be obtained by including all program sources. For information on submitting this issue, please see http://www.intel.com/software/products/support/. Aborted (core dumped)
I'm on Ubuntu Linux, and currently running anaconda. I activate spex prior to running the file using
conda activate spex.
. I suspect I may have installed something wrong, but I'm unsure. Googling the issue hasnt really yielded too much, although quite a bit of similar issues seem to point towards conda. Any help or a pointer in the right direction would be appreciated. I can provide any info needed as well.Also as a side question, I was curious if there was an equivalent command in pyspex for spex's "plot adum" command that creates a text file consisting of the data from the spectrum currently on the plot window? Looking through the command wiki, I havent found a pyspex adum, but perhaps I missed it.
Thank you!