When querying the Pan-STARRS catalog via astroquery.mast, the MAST server occasionally returns the literal string 'None' for missing values in numeric columns (e.g., magnitudes or error fields).
The internal helper function _json_to_table in astroquery/mast/services.py attempts to convert the data column to its expected NumPy type using .astype(col_type). If the column is expected to be a float64 but contains the string 'None', Python raises a ValueError: could not convert string to float: 'None', causing the entire query to crash.
Environment
OS: macOS 26.3 (Apple Silicon w/ osx-64 env)
Python version: 3.11
astroquery version: Latest
Service: astroquery.mast.Catalogs (Pan-STARRS)
Error message is like this:
Traceback (most recent call last):
File "/Users/alexlee/Lab/autophot/test.py", line 17, in <module>
raw_result = Catalogs.query_region(target_coords, radius=0.1*u.deg, catalog='Panstarrs')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexlee/miniconda3/envs/autophot_x86/lib/python3.11/site-packages/astroquery/utils/class_or_instance.py", line 25, in f
return self.fn(obj, *args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexlee/miniconda3/envs/autophot_x86/lib/python3.11/site-packages/astroquery/utils/process_asyncs.py", line 35, in newmethod
result = self._parse_result(response, verbose=verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexlee/miniconda3/envs/autophot_x86/lib/python3.11/site-packages/astroquery/mast/collections.py", line 57, in _parse_result
results_table = self._current_connection._parse_result(response, verbose=verbose)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexlee/miniconda3/envs/autophot_x86/lib/python3.11/site-packages/astroquery/mast/services.py", line 237, in _parse_result
result_table = _json_to_table(result, data_key=data_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alexlee/miniconda3/envs/autophot_x86/lib/python3.11/site-packages/astroquery/mast/services.py", line 106, in _json_to_table
data_table.add_column(MaskedColumn(col_data.astype(col_type), name=col_name, mask=col_mask))
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'None'
Python code to reproduce:
from astropy.coordinates import SkyCoord
import astropy.units as u
from astroquery.mast import Catalogs
target_coords = SkyCoord(ra=133.564987, dec=53.053127, unit="deg")
raw_result = Catalogs.query_region(target_coords, radius=0.1*u.deg, catalog='Panstarrs')
Thank you!
When querying the Pan-STARRS catalog via astroquery.mast, the MAST server occasionally returns the literal string 'None' for missing values in numeric columns (e.g., magnitudes or error fields).
The internal helper function _json_to_table in astroquery/mast/services.py attempts to convert the data column to its expected NumPy type using .astype(col_type). If the column is expected to be a float64 but contains the string 'None', Python raises a ValueError: could not convert string to float: 'None', causing the entire query to crash.
Environment
OS: macOS 26.3 (Apple Silicon w/ osx-64 env)
Python version: 3.11
astroquery version: Latest
Service: astroquery.mast.Catalogs (Pan-STARRS)
Error message is like this:
Python code to reproduce:
Thank you!