astrolabsoftware / fink-science-portal

Fink Science Portal
https://fink-portal.org
Apache License 2.0
7 stars 4 forks source link

TNS classification not being updated #633

Closed anaismoller closed 1 month ago

anaismoller commented 1 month ago

TNS labels are not being updated in the portal

e.g. https://fink-portal.org/ZTF24aasmghi which a SN in https://www.wis-tns.org/object/2024lua

https://fink-portal.org/ZTF24aatfxrw https://www.wis-tns.org/object/2024ntb

Thanks :)

Anais

JulienPeloton commented 1 month ago

Thanks for reporting! This is weird indeed, I will inspect.

JulienPeloton commented 1 month ago

Found the bug! If you use the resolver (what is done under the hood):

In [1]: import pandas as pd
In [2]: import io
In [3]: import requests
In [4]: r = requests.post(
   ...:   'https://fink-portal.org/api/v1/resolver',
   ...:   json={
   ...:     'resolver': 'tns',
   ...:     'reverse': True,
   ...:     'name': 'ZTF24aasmghi'
   ...:   }
   ...: )
In [5]: pdf = pd.read_json(io.BytesIO(r.content))
In [6]: pdf
Out[6]: 
   d:redshift  d:declination  d:fullname d:internalname        d:ra d:type       key:time
0       0.081      -8.361115  SN 2024lua   ZTF24aasmghi  326.260632  SN Ia  1720641934017
1         NaN      -8.361131  AT 2024lua   ZTF24aasmghi  326.260667    nan  1719777949758

there are 2 entries -- but we always take the last entry:

https://github.com/astrolabsoftware/fink-science-portal/blob/119e099ef0e547810d6a901369949e9baa6e9feb/apps/cards.py#L874

I will fix this!

anaismoller commented 1 month ago

Interesting bug!

I am guessing the key:time may be useful to get the latest?

Thanks!

JulienPeloton commented 1 month ago

Fixed in #635 :-)