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

get_obsid throws ValueError for dwell at '2024:283:22:32:53.312' #337

Open
jeanconn opened this issue Oct 10, 2024 · 3 comments
Open

get_obsid throws ValueError for dwell at '2024:283:22:32:53.312' #337

jeanconn opened this issue Oct 10, 2024 · 3 comments
Labels

Comments

@jeanconn
Copy link
Contributor

jeanconn commented Oct 10, 2024

This was failing when I opened this bug last week, but this kadi dwell is no longer failing. I don't know if that's because the events3.db3 is different or because COBSRQID now has more data for get_obsid().

In [1]: from kadi import events

In [2]: dwells = events.dwells.filter(start__exact='2024:283:22:32:53.312')

In [3]: dwells
Out[3]: <Dwell: start=2024:283:22:32:53.312 dur=2122>

In [4]: dwells[0].get_obsid()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[4], line 1
----> 1 dwells[0].get_obsid()

File /proj/sot/ska3/flight/lib/python3.11/site-packages/kadi/events/models.py:525, in BaseModel.get_obsid(self)
    523 obsids = query.obsids.filter(start, start)
    524 if len(obsids) != 1:
--> 525     raise ValueError(
    526         "Expected one obsid at {} but got {}".format(start, obsids)
    527     )
    528 return obsids[0].obsid

ValueError: Expected one obsid at 2024:283:22:32:53.312 but got 
@jeanconn jeanconn added the bug label Oct 10, 2024
@jeanconn
Copy link
Contributor Author

In [10]: manvrs = events.manvrs.filter(start__exact="2024:285:11:49:24.783")

In [11]: manvrs[0].obsid
Out[11]: 62615

In [12]: manvrs[0].get_obsid()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[12], line 1
----> 1 manvrs[0].get_obsid()

File /proj/sot/ska3/flight/lib/python3.11/site-packages/kadi/events/models.py:525, in BaseModel.get_obsid(self)
    523 obsids = query.obsids.filter(start, start)
    524 if len(obsids) != 1:
--> 525     raise ValueError(
    526         "Expected one obsid at {} but got {}".format(start, obsids)
    527     )
    528 return obsids[0].obsid

ValueError: Expected one obsid at 2024:285:12:26:43.383 but got 

@jeanconn
Copy link
Contributor Author

@taldcroft

@jeanconn
Copy link
Contributor Author

No biggie then if kadi.events.dwells are deprecated - I think I should be able to use manvr.obsid in all cases, I was just surprised by this behavior on the dwells.

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

No branches or pull requests

1 participant