Skip to content

Conversation

@Sulla2012
Copy link
Contributor

Add a build_obslist analogue to map cat. This function allows users to input a list of obs_ids and receive 1) a dict with keys the obs_id and entries the Depth-1 maps associated with each obs_id and 2) a list of obs_id not in any map.

@Sulla2012
Copy link
Contributor Author

@chervias I'd like to know if the function build_obslist does what you need it to do and if it needs further features.

if len(tods) == 0: # pragma: no cover
raise ValueError(f"No TODs with obs ID {obs_id} found.")

depth_one_maps = [tod.maps for tod in tods][0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only returns a single map right? When in reality multiple may match.

I think you can do this all in one sql query:

SELECT m.*
FROM depth_one_maps AS m
JOIN link_tod_to_depth_one_map AS link
  ON m.map_id = link.map_id
JOIN tod_depth_one AS t
  ON link.tod_id = t.tod_id
WHERE t.obs_id = 'obs_1758179265_lati1_111'

There should be some way of representing this as SQLAlchemy...

Copy link
Contributor Author

@Sulla2012 Sulla2012 Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be able to return multiple maps, see 209/210 in test_mapmaking.py. I did just notice that the [0] index is cutting it down to only the first returned TOD. I forgot about this issue, I was treating the obs_idas if there could be more than one TOD with a givenobs_id, but that shouldn't be. The obs_id` are one-to-one with the TODs. I'll change that.

@chervias
Copy link
Member

chervias commented Oct 31, 2025

Hi @Sulla2012 yes I think it works. So in theory we will have a list of maps-to-be-made in the mapmaker, and then we need to run that list against something checking which maps stay and which maps are removed. Is it any different running that list against the full sql database versus running that list against the output of build_obslist? if the answer is yes then it's worth it. Also could you change the name so we don't confuse it with the build_obslists function on sotodlib. Something like obs2maps or something. Thanks

@JBorrow JBorrow merged commit 4c467a7 into main Nov 6, 2025
5 checks passed
@JBorrow JBorrow deleted the tod-tools branch November 6, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants