-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError due to astropy #64
Comments
An update: I have produced new divergent simulation with only positive values for azimuth angles and I didn't receive any error and the dl1 generation was successful. For some reasons astropy is not happy with the negative values. |
That's strange, as it is normally quite happy with negative azimuth, you can even decide yourself if you want to have it between (-180, 180) or (0, 360):
|
I also cannot make out which part of the code raises the error, you traceback does not match the current master. Which branch are you using? |
The branch is the same as the master, no modification, and for the new simulations I simply added 360deg to the negative values. The problem appears at the line 1154 in |
What is:
If it is numpy.ndarray or astropy.Quantity, what is
|
The values are all float32. And the first is class astropy.units.quantity.Quantity |
Ok, then I think you should convert these to With |
ok that solved the problem I analysed one file successfully. I don't see why only the negative values need so much precision. Thanks anyway. |
If you want you can open a PR to fix this, then I can keep it open until I update the master with the API change that is currenty in the draft PRs |
If we think about real data, it's possible to have negative values, but maybe it's best to transform them to positive ones if the negative ones need more memory. |
No, I don't think it has anything to do with the sign. It is just generally true that not all float64 values are exactly representable as float32, so this will be always an issue when reading real world floating point data as float32 and dowcasting with the rule
So the sign is not the problem here. |
I fail to reproduce this, what is your astropy version? |
It's actually 3.2.3. I didn't update the environment installation since the master is still using ctapipe 0.7. So I stayed with the version I got when installing protopipe. |
seems to be fixed in astropy 4 |
I'll keep this issue open until the next minor release. There we should use astropy 4 by default because, if I am not wrong, ctapipe right now requires the latest astropy up to 5 excluded. |
I could not even reproduce this error with simple examples using astropy 3. |
@adonini could you open a PR with what you did from Max's advice if it solved this problem? Also, I did not understand if you did it only for the negative values or to all coordinates. |
At the end for my results I used the "positive" simulations, that didn't need any modification of the code. Anyway I was able to produce DL1 files converting only the negative values for the older simulations. I can do some tests and see if also DL2 files are produced. But I would wait for the minor release and see how it goes with the newer version of astropy for a PR. No need to take up more memory than necessary. |
I can give you one of my files if you want. |
Don't worry please about the memory here. If the simplest solution is converting to float64, do that. |
@adonini Could you post here the LFN of a file that causes this crash? The test file that I added for
|
If you took them before August, then is the very first sample and it was ok. Every pointing had positive angles. You can retrieve the files you want from here /vo.cta.in2p3.fr/MC/PROD3/LaPalma/gamma/simtel/2233/Data/000xxx . It's the simulation for 1.5x the nominal FoV. |
Lunching the first script write_dl1.py with the files from the new divergent simulations I get the following error due to astropy when creating
reco_result
:If I use a file from the old simulations the script run without error. Both the simulations were done using the same CORSIKA and SIMTEL version, only difference is the add of a TELESCOPE 0 in the simtel conflict file that correspond to the array pointing. I checked and this should not interfere, I have 19 telescope with ID from 1 to 19.
The value of
point_azimuth_dict[tel_id]
andpoint_altitude_dict[tel_id]
are both float32. One difference with the old simulation is that I have some negative value for the azimuth.Maybe this can be the problem for astropy? @vuillaut @maxnoe
The paths to both new and old simulation on the GRID can be find on redmine here https://forge.in2p3.fr/issues/36268
The text was updated successfully, but these errors were encountered: