madamow / pymoogi

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

out3 is getting cut short #16

Closed acnine closed 2 years ago

acnine commented 2 years ago

Hi all,

I'm running pyMOOGi 1.0.0 on MacOS 12.3.1, with:

When I try to run synth_example.par in the example directory, I get the error:

Traceback (most recent call last): File "/Users/andrewnine/opt/anaconda3/bin/pymoogi", line 33, in sys.exit(load_entry_point('pyMOOGi==1.0.0', 'console_scripts', 'pymoogi')()) File "/Users/andrewnine/opt/anaconda3/lib/python3.8/site-packages/pyMOOGi-1.0.0-py3.8.egg/pymoogi/main.py", line 50, in main p = SynthPlot(params) File "/Users/andrewnine/opt/anaconda3/lib/python3.8/site-packages/pyMOOGi-1.0.0-py3.8.egg/pymoogi/lib/Synth.py", line 48, in init self.slam, self.sflux = out3_synth(self.pars['smoothed_out'][0][1:-1]) File "/Users/andrewnine/opt/anaconda3/lib/python3.8/site-packages/pyMOOGi-1.0.0-py3.8.egg/pymoogi/lib/read_out_files.py", line 116, in out3_synth tab_out3 = np.vstack([tab_out3, np_flux[:, 1]]) File "<__array_function__ internals>", line 5, in vstack File "/Users/andrewnine/opt/anaconda3/lib/python3.8/site-packages/numpy/core/shape_base.py", line 283, in vstack return _nx.concatenate(arrs, 0) File "<__array_function__ internals>", line 5, in concatenate ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 251 and the array at index 1 has size 229

When I open out3 to check, the last synthetic spectrum has been cut short. The spectrum before it ends

. . . 6104.900 1.00000 6104.920 1.00000 6104.940 1.00000 6104.960 1.00000 6104.980 1.00000 6105.000 1.00000

as expected (251 entries), but the last spectrum ends

. . . 6104.480 0.99879 6104.500 0.99871 6104.520 0.99807 6104.540 0.99660 6104.560 0.99402

(229 entries). How do I fix this?

madamow commented 2 years ago

On it.

Xarthisius commented 2 years ago

What's your gfortran version? Could you please provide output from the following command:

$ gfortran -v
Xarthisius commented 2 years ago

As a workaround you could try this:

$ export GFORTRAN_UNBUFFERED_ALL=y
$ pymoogi

Not sure yet why files are not flushed upon closing on OSX...

acnine commented 2 years ago

Here is the full readout from gfortran -v:

Using built-in specs.

COLLECT_GCC=/Applications/mesasdk/bin/gfortran.exec

COLLECT_LTO_WRAPPER=/Applications/mesasdk/bin/../libexec/gcc/x86_64-apple-darwin20.3.0/10.2.0/lto-wrapper

Target: x86_64-apple-darwin20.3.0

Configured with: /opt/sdk2-tmp/build/gcc/configure CC=clang CXX=clang++ --build=x86_64-apple-darwin20.3.0 --host=x86_64-apple-darwin20.3.0 --target=x86_64-apple-darwin20.3.0 --prefix=/opt/sdk2-tmp/mesasdk --with-gmp=/opt/sdk2-tmp/mesasdk --with-mpfr=/opt/sdk2-tmp/mesasdk --with-mpc=/opt/sdk2-tmp/mesasdk --enable-languages=c,c++,fortran --disable-multilib --disable-nls --disable-libsanitizer --with-sysroot=/opt/sdk2-tmp/mesasdk/sysroot

Thread model: posix

Supported LTO compression algorithms: zlib

gcc version 10.2.0 (GCC)

The export GFORTRAN_UNBUFFERED_ALL=y workaround was successful, thanks for that!