Skip to content
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

Pipeline breaks when ra_uncertainty or dec_uncertainty is set to 0.0 #704

Open
ddobie opened this issue Feb 6, 2024 · 1 comment
Open

Comments

@ddobie
Copy link
Contributor

ddobie commented Feb 6, 2024

The latest post-processing code will account for the systematic uncertainty in the ASKAP positions, so we can now set ra_uncertainty and dec_uncertainty to zero.

However, this breaks the pipeline:

2024-02-06 04:33:05,969 runpipeline ERROR Processing error:
Catalog coordinates cannot contain NaN entries.
Traceback (most recent call last):
  File "/import/ada2/ddob1600/vast-pipeline/vast_pipeline/management/commands/runpipeline.py", line 340, in run_pipe
    pipeline.process_pipeline(p_run)
  File "/import/ada2/ddob1600/vast-pipeline/vast_pipeline/pipeline/main.py", line 225, in process_pipeline
    sources_df = association(
  File "/import/ada2/ddob1600/vast-pipeline/vast_pipeline/pipeline/association.py", line 1267, in association
    sources_df, skyc1_srcs = advanced_association(
  File "/import/ada2/ddob1600/vast-pipeline/vast_pipeline/pipeline/association.py", line 938, in advanced_association
    idx_skyc1, idx_skyc2, d2d, d3d = skyc2.search_around_sky(
  File "/import/ada2/ddob1600/.conda/envs/vast-pipeline-dev/lib/python3.8/site-packages/astropy/coordinates/sky_coordinate.py", line 1511, in search_around_sky
    return search_around_sky(searcharoundcoords, self, seplimit,
  File "/import/ada2/ddob1600/.conda/envs/vast-pipeline-dev/lib/python3.8/site-packages/astropy/coordinates/matching.py", line 365, in search_around_sky
    kdt1 = _get_cartesian_kdtree(ucoords1, storekdtree)
  File "/import/ada2/ddob1600/.conda/envs/vast-pipeline-dev/lib/python3.8/site-packages/astropy/coordinates/matching.py", line 472, in _get_cartesian_kdtree
    raise ValueError("Catalog coordinates cannot contain NaN entries.")
ValueError: Catalog coordinates cannot contain NaN entries.
CommandError: Processing error:
Catalog coordinates cannot contain NaN entries.

I have tested the same data with ra_uncertainty and dec_uncertainty set to 1.0 (the default) and 0.0, and the error only seems to occur with 0.0.

My assumption is that these values are converted to weights somewhere (i.e. 1/uncertainty) which then results in NaN values. Maybe here:

# TODO: avoid extra column given that it is a single value
df['ew_sys_err'] = self.config["ra_uncertainty"] / 3600.
df['ns_sys_err'] = self.config["dec_uncertainty"] / 3600.
df['error_radius'] = calc_error_radius(
df['ra'].values,
df['ra_err'].values,
df['dec'].values,
df['dec_err'].values,
)
df['uncertainty_ew'] = np.hypot(
df['ew_sys_err'].values, df['error_radius'].values
)
df['uncertainty_ns'] = np.hypot(
df['ns_sys_err'].values, df['error_radius'].values
)
# weight calculations to use later
df['weight_ew'] = 1. / df['uncertainty_ew'].values**2
df['weight_ns'] = 1. / df['uncertainty_ns'].values**2

@ddobie
Copy link
Contributor Author

ddobie commented Feb 19, 2024

Origin of this is that for whatever reason, some selavy sources have zero astrometric uncertainty. These should probably be padded in some way (e.g. at post-processing we should set a minimum astrometric uncertainty) but in the meantime it's possible to get around this by just setting the ra_uncertainty and dec_uncertainty to some small number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

No branches or pull requests

1 participant