vlas-sokolov / bayesian-ngc1333

Nested sampling of the GAS DR1 NGC1333 ammonia data
MIT License
2 stars 3 forks source link

How to adjust the sampe parameters to reduction the sample time. #10

Open ChaoOu-GXU opened 3 weeks ago

ChaoOu-GXU commented 3 weeks ago

Hello! I follow the usage of pyspecnest to fit the ammonia spectral line with two velocity components. The interval of two velocity components ranges from 0.6 km/s to 3km /s. I use the script to sample 3500 spectral lines of NH3(1,1) and NH3(2,2) , with command:

       python pool_xy.py 2 ‘snr’ 3 96

In this case, I only change the priors of Vlsr in my ammonia data. However, the total sample time is 24 hours and longer, where the sample parameter is the same as the tutorial, please see the attached first figure. Sometimes, the sampler will crash in a certain thread. I modify the sample parameter of max_iter to reduce the sample time. The niter of 6000 corresponds to the acceptance rate of ~ 0.4, see the second figure. This only takes about 3 hours. However, the estimated parameter is unacceptable, see the last figure which is the Vlsr map. Also, I tested other sample parameters, such as evidence_tolerance=0.3, which are not executed in the running of the script. I did not obtain more good estimated parameters. My system of the computer is Linux and the environment is as below:

   Python=3.10.15,
   mpi4py=3.1.4,
   pymultinest =2.12,
   pyspeckit =1.0.3,
   pyspecnest=0.0.0
   astropy= 6.1.4,
   spectral-cube= 0.6.5,
   libmultinest.so3.10, corresponds to MultiNest v3.10.

I want to obtain the estimated parameter of acceptable and sample time is lower than 24 hours for the about 20000 spectral lines, including with the previous 3,500 lines. What should I do? Looking forward to your reply!

Best wishes, Chao

image image image

vlas-sokolov commented 3 weeks ago

It's impossible to say what's causing your troubles without checking the individual spectra and see what's wrong there - you can't really tell much from just looking at one parameter map. Are there multiple components and the fit jumps from one to the other? Does your parameter space include the "best fit" in it at all? I don't know any of that. Oftentimes you should start with a really small submap to learn all the knobs and whistles first before burning compute time on the problem.

As for the runtime question, you should really refer to other works for that. The scripts in this repo are calling pymultinest, which, in turn, calls multinest, which has thousands of citations, so surely I'm not the best advisor there.

I hope this helps.

ChaoOu-GXU commented 6 days ago

It's impossible to say what's causing your troubles without checking the individual spectra and see what's wrong there - you can't really tell much from just looking at one parameter map. Are there multiple components and the fit jumps from one to the other? Does your parameter space include the "best fit" in it at all? I don't know any of that. Oftentimes you should start with a really small submap to learn all the knobs and whistles first before burning compute time on the problem.

As for the runtime question, you should really refer to other works for that. The scripts in this repo are calling pymultinest, which, in turn, calls multinest, which has thousands of citations, so surely I'm not the best advisor there.

I hope this helps.

Thanks for your help! Sorry for the late reply! I recently learned about nestfits (Brian Svoboda 2020), which is similar to pyspecnest. It is compiled using Cpython, and the sampling time is much faster than pyspecnest. I will priors use it.

For your advice about pyspecnest, I'd like to ask you one question. A best fit for one or multiple components relies on the evidence factor. For example, the evidence of two components (Z2) is five times greater than the evidence of one component (Z1). The former will be chosen as best fit (e.g., Sokolov et al.2020). Because of my first contact with this method and lack of background knowledge, I don't understand why this is cut.

Best wishes, Chao