phoebe-project / phoebe2

PHOEBE - Eclipsing Binary Star Modeling Software
http://phoebe-project.org
GNU General Public License v3.0
76 stars 28 forks source link

Warning when using run-compute() #908

Closed karanbt closed 1 week ago

karanbt commented 1 week ago

Discussed in https://github.com/phoebe-project/phoebe2/discussions/805

Originally posted by **minnieliao** December 7, 2023 Hi, I was following Phoebe's tutorials on the compute section. I'm encountering an error similar to the one posted here when using run_compute() on my default binary bundle. here is my code ``` import phoebe phoebe.download_passband("Johnson:V", content=None, local=True, gzipped=None) b = phoebe.default_binary() b.add_dataset('lc', compute_times=phoebe.linspace(0,1,51), dataset='lc01') b.add_dataset('rv', compute_times=phoebe.linspace(0,1,21), dataset='rv01') b.run_compute() ``` The error I have been getting is: **/home/karanbt/miniconda3/envs/astro/lib/python3.11/site-packages/astropy/io/fits/file.py:456: AstropyUserWarning: File may have been truncated: actual file length (294912) is smaller than the expected size (2165760) warnings.warn( TypeError: buffer is too small for requested array** However, despite downloading the passband and upgrading to the latest package versions, it did not work for me. I would appreciate it if someone could assist me with this. Thanks.
aprsa commented 1 week ago

We could catch such problems by running checksums ahead of time. It seems to happen frequently, which puzzles me. Guess the downloads time out and fail, causing this issue.

karanbt commented 1 week ago

Is it possible that the issue is caused by the FITS file generated consuming more memory than the memory allocated to WSL on my system? The other day, I was able to run the notebook on Google Colab without encountering any errors.

aprsa commented 1 week ago

I don't think so - I imagine that we would get an out-of-memory exception in that case, not a silent truncation. This seems to be a corrupted passband file while being downloaded from phoebe servers. This happens infrequently, but still frequently enough that it shows up. What happens if you try to load the passband directly?

pb = phoebe.get_passband('Johnson:V')
print(pb.content)
karanbt commented 1 week ago

This is the output I receive when I attempt to load the passband directly.

['ck2004:Inorm', 'phoenix:ld', 'phoenix:Inorm', 'ck2004:ldint', 'extern_atmx:Inorm', 'blackbody:Inorm', 'extern_planckint:Inorm', 'ck2004:ld', 'phoenix:ldint', 'phoenix:Imu', 'ck2004:Imu']

One of my colleagues suggested that the issue might be related to memory allocation, as I am using an old system with 4GB of RAM and WSL can only utilize half of the system's RAM.

aprsa commented 1 week ago

I still don't think this has to do with the amount of RAM; passband tables are of the order of 15MB in size. Can you please show me the output of ls -lh ~/.phoebe/atmospheres/tables/passbands? If you don't have any passbands in there, can you find the same directory in your install path, either /usr/local/ if a global install, or /path/to/venv/lib if in a venv?

aprsa commented 1 week ago

Also, can you check that the bolometric passband is loading correctly?

pb = phoebe.get_passband('Bolometric:900-40000')
print(pb.content)
karanbt commented 1 week ago

I still don't think this has to do with the amount of RAM; passband tables are of the order of 15MB in size. Can you please show me the output of ls -lh ~/.phoebe/atmospheres/tables/passbands? If you don't have any passbands in there, can you find the same directory in your install path, either /usr/local/ if a global install, or /path/to/venv/lib if in a venv?

Below is the output I received for the list of files in the directory. This clearly shows that the bolometric passband is being truncated while downloading.

total 12M -rw-r--r-- 1 karanbt karanbt 288K May 24 19:23 bolometric_900-40000.fits -rw-r--r-- 1 karanbt karanbt 12M Jun 25 11:46 johnson_v.fits

Also, can you check that the bolometric passband is loading correctly?

pb = phoebe.get_passband('Bolometric:900-40000')
print(pb.content)

WARNING: File may have been truncated: actual file length (294912) is smaller than the expected size (2165760) [astropy.io.fits.file]

It seems that the bolometric passband has been causing the loading issue. And I was able to call run_compute() without encountering any errors after explicitly redownloading the bolometric passband.

Thanks.