fkiwy / Finder_charts

A Python module to create finder charts from image data of various sky surveys
MIT License
3 stars 0 forks source link

PIL has no attribute ANTIATLAS warning (versioning issue ?) #4

Closed jgagneastro closed 4 months ago

jgagneastro commented 4 months ago

I have encountered the following problem when running this example code:

from Finder_charts import create_finder_charts, Crosshair, Survey, Target
from astropy.time import Time
import tempfile

ra, dec=0,0
pmra, pmdec=-100,100
ref_epoch = Time(2015.0, format='jyear')

create_finder_charts(ra, dec, pmra=pmra, pmdec=pmdec, ref_epoch=ref_epoch, crosshair_type=Crosshair.CROSS_NO_CENTER)
crosshair_type=Crosshair.CROSS_NO_CENTER)
A problem occurred while creating a color image for object ra=273.721554, dec=-26.914877
Traceback (most recent call last):
  File "/Users/jonathan/Documents/Python/Python_Packages/Finder_charts/Finder_charts.py", line 225, in create_color_image
    r = Image.fromarray(create_lupton_rgb(r)).convert('L').resize((xmax, ymax), Image.ANTIALIAS)

It seems like this could be caused by a version issue in PIL.

Further down the line, the code crashes with this error message:

    b, gaia_wcs, obs_coords = create_gaia_finder_chart(ra, dec, size=img_size, band='Bp', epoch=gaia_epoch)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jonathan/Documents/Python/Python_Packages/Finder_charts/Gaia_finder_chart.py", line 235, in create_gaia_finder_chart
    gaia_sources = get_gaia_sources(obs_coords, obs_time, radius=RADIUS)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jonathan/Documents/Python/Python_Packages/Finder_charts/Gaia_finder_chart.py", line 156, in get_gaia_sources
    sources['gaia_id'].append(table_row['source_id'])
                              ~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/anaconda3-native/anaconda3/envs/kiwy_fcharts/lib/python3.12/site-packages/astropy/table/row.py", line 64, in __getitem__
    out = self._table.columns[item][self._index]
          ~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/anaconda3-native/anaconda3/envs/kiwy_fcharts/lib/python3.12/site-packages/astropy/table/table.py", line 267, in __getitem__
    return OrderedDict.__getitem__(self, item)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'source_id'

This could also be caused by a versioning issue, which might be fixed by providing exact package version requirements in setup.py.

jgagneastro commented 4 months ago

I think I have fixed this with a fresh reinstall of Finder_charts in a new conda environment. I am not sure why it worked out differently the first time around - I think at some point I had installed "requests" with conda after my Finder_charts installation, which might have broken something. Here is the current versions of every package I ended up with in the conda environment where my Finder_charts installation works (the only thing I did was python setup.py install from Finder_charts's current repo, and then conda install pandas for my own use in the same env) :

asciitree==0.3.3
astropy==6.1.1
astropy-iers-data==0.2024.7.8.0.31.19
astropy_healpix==1.0.3
astroquery==0.4.8.dev9321
beautifulsoup4==4.13.0b2
certifi==2024.7.4
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
contourpy==1.2.1
crc32c==2.4.1
cycler==0.12.1
dask==2024.7.0
donfig==0.8.1.post1
fasteners==0.19
Finder_charts==1.1.0
fonttools==4.53.1
fsspec==2024.6.1
html5lib==1.1
idna==3.7
iniconfig==2.0.0
jaraco.classes==3.4.0
jaraco.context==5.3.0
jaraco.functools==4.0.1
keyring==25.2.1
kiwisolver==1.4.5
locket==1.0.0
matplotlib==3.9.1
more-itertools==10.3.0
numcodecs==0.12.1
numpy==2.0.0
packaging==24.1
pandas @ file:///Users/runner/miniforge3/conda-bld/pandas_1715897635637/work
partd==1.4.2
pillow==10.4.0
pluggy==1.5.0
pyerfa==2.0.1.4
pyparsing==3.1.2
pytest==8.2.2
python-dateutil==2.9.0.post0
pytz @ file:///home/conda/feedstock_root/build_artifacts/pytz_1706886791323/work
pyvo==1.5.2
PyYAML==6.0.2rc1
reproject==0.13.1
requests==2.32.3
scipy==1.14.0
setuptools==70.1.1
six==1.16.0
soupsieve==2.5
tdqm==0.0.1
toolz==0.12.1
tqdm==4.66.4
typing_extensions==4.12.2
tzdata @ file:///home/conda/feedstock_root/build_artifacts/python-tzdata_1707747584337/work
urllib3==2.2.2
webencodings==0.5.1
wheel==0.43.0
zarr==3.0.0a0
zstandard==0.22.0