Open zhenxuanSUN opened 2 months ago
Hello, thanks for reaching out!
The amount of data should not be a problem, especially with that many cores. How are you running the code, are you using an interactive python session of some sort or running on a computing cluster?
My guess is that you are running into an issue with multiprocessing where it gets stuck in an infinite loop. This can happen sometimes when "unsafe_mp" is set to "True" and the code is run directly in an interactive shell or certain Jupyter notebooks (depends on the setup). It might work if you change the your "name guard" line to if __name__=='__main__'
(the underscores are essential). If that does not work, please try saving your script in a separate file (including the name guard and a line to save the results to disk) and then running the script from ipython or Jupyter using the command run your_script_name.py
.
As a last resort, you can try running your code above in a single thread by setting either ncpu=1
or unsafe_mp=False
. The code will take longer to run (probably no more than 5 or 6 min), but it should yield the desired results.
Hope this helps!
Hi MJWeberg!
Thank you for your reply and detailed advice!
I underlined the "name guard" line in my programif __name__=='__main__'
, but forgot to add it here due to an oversight. I'm using Spyder, and it's probably the same as you're guessing with Jupyter, for example.
When I did what you said about single-core computation and set "unsafe_mp" to False, the results ran very quickly!
ncpu=1
unsafe_mp=False
I'm trying to fit a moment in time EIS data with dimensions (512, 123, 24) using fit_spectra, but it shows: Found a wavelength 195.12 [Angstroms] in window 8 INFO: uncertainty should have attribute uncertainty_type. [astropy.nddata.] + computing fits for 123 exposures, each with 512 spectra+ running mpfit on 24 cores (of 24)
It ran for a long time with no results, I don't know if it's a result of the amount of data or if there's something wrong with my code. But after reducing the range (raster_cutout = data_cube.crop(lower_left, upper_right)) I can get the result soon. Here is the code for my fitting part:
if name == 'main':