madamow / pymoogi

python wrapper for MOOG. All plots are handled with matplotlib.
10 stars 4 forks source link

Synthesis does not work if plot is set to 0 #27

Open nagarajvernekar30 opened 2 months ago

nagarajvernekar30 commented 2 months ago

I am trying to create a grid using MOOG and for this, I don't want the plots appear. But when I set "plot 0" which should stop creating plots, the code gives an error saying

At line 61 of file Smooth.f Fortran runtime error: Illegal seek

This seems like its an issue within moog but I am not sure. The same par file works perfectly when plot is set to 1 or 2. Do you know how to solve this?

my par file:

synth standard_out 'EU.out1' summary_out 'EU.out2' smoothed_out 'sun_moog_vald.out3' model_in 'out.atm' lines_in '4200.txt' observed_in 'sun_weave.txt' atmosphere 1 lines 1 molecules 2 flux/int 0 damping 1 plot 0 abundances 1 1 6 0 isotopes 11 1 607.01214 1.11 1.25 1.25 1.25 1.25 607.01314 10.0 5. 5. 5. 5. 607.01215 1098. 1098. 1098. 1098. 1098. 106.00112 1.11 1.25 1.25 1.25 1.25 106.00113 10.0 5. 5. 5. 5. 822.01648 1.0 1.0 1.0 1.0 1.0 606.01212 1.0 1.0 1.0 1.0 1.0 114.00128 1.0 1.0 1.0 1.0 1.0 112.00124 1.0 112.00125 999 112.00126 999 synlimits 4200 5000 0.05 1.0 plotpars 1 4200 4800 0.00 1.05 0.00 0.00 0.000 1.00 g 0.0 0.0 0.0 0.0 0.0 obspectrum 5

madamow commented 2 months ago

I am taking a look now.

madamow commented 2 months ago

Can you try running the synth_example.par file with theplot option set to 0 and see if it works as it should?

nagarajvernekar30 commented 2 months ago

Hello,

Thanks for the quick reply. I tried with the example par file, and it does not work there. It could be something to do with moog installation, so I will try reinstalling pymoogi and let you know.

nagarajvernekar30 commented 2 months ago

Hey, I just tried reinstalling pymoogi and tried but the error is still the same. So I created a separate environment and install pymoogi there but still I have the same error. So I am not sure anymore.

madamow commented 2 months ago

The block of code that gives you the error reads the atmospheric model file. Are you able to run the original synth_example.par file at all?

nagarajvernekar30 commented 2 months ago

it runs when plot is set to 1 or 2. It fails as soon as its set to 0. Also, it creates out1 and out2 file but does not create the out3 file. This makes me think that the synthesis seems to be working, only the smoothening part is failing.

Update: Just tried it on a new computer that never had pymoogi or MOOG installed in it. I still get the same error. I actually do not care about the smoothened spectrum as i do not add any. So are you aware of where in the code I could ask it to make a new file with the unsmoothened flux?

madamow commented 2 months ago

I am afraid I cannot help you if I cannot recreate your error. To do that, I need to know:

  1. your operating system and its version
  2. Your Python version
  3. How and with what (exact version) did you compile MOOG's Fortran code?

I will try to recreate your environment and see if I can get the same error.

nagarajvernekar30 commented 2 months ago

Specs of my system are: OS: Ubuntu 22.04 Python: 3.11.5 but also tried on 3.9 GCC : 11.4.0

For compiling MOOG, I went into pymoogi/pymoogi/MOOG and executed 'make'. This gave me the output that MOOG was successfully installed. After this, I added the line 'export MOOGPATH=/home/adorea/pymoogi/pymoogi/moog' into my bashrc and then installed pymoogi using the python setup file.

I just used a different version of MOOGSILENT (NOV2019) and it seems to be working. So ya, it could be something with the way MOOG was compiled but I am not sure exactly what I did wrong.

madamow commented 2 months ago

Thanks! I am glad you found a way around it. If you have a working MOOG version from elsewhere, you do not have to use the one distributed with pyMOOGi. Just point it to the correct executable.