Skip to content

Conversation

@ying2212
Copy link
Collaborator

@ying2212 ying2212 commented Jun 17, 2025

Short description: This pull request is to ingest photometry and proper motion data from Pan-STARRS catalog

Link to relevant issue: #609

For data ingests:

  • includes script used for ingest
  • includes modified JSON files
  • Add new tests
  • Update the Versions table

@ying2212 ying2212 requested a review from kelle June 17, 2025 20:01
@ying2212 ying2212 changed the title Implement manual photometry and proper motion ingestion Implement Pan-STARRS manual photometry and proper motion ingestion Jun 17, 2025
@kelle
Copy link
Collaborator

kelle commented Jun 18, 2025

The ingest_photometry script looks good! Is it faster?

Discuss with @canavarrete01 the best way to move forward modifying and reviewing so many JSON files.

@kelle kelle requested a review from canavarrete01 June 18, 2025 15:57
@ying2212
Copy link
Collaborator Author

yes! speedup for ~2 seconds per 100 rows.

Also, I didn’t manually ingest the proper motion data as the runtime not change as much.

@ying2212
Copy link
Collaborator Author

I went through the Pan-STARRS data and everything looks good. ~2,080 sources are valid for ingesting into schema.
Would need a review!

Comment on lines 80 to 81
logger.warning(msg)
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep track of the sources which did not find matches.

@kelle
Copy link
Collaborator

kelle commented Jun 26, 2025

Awesome!

Thinking about this, I think the best way to review this data before we ingest to the database is to make a CSV file. So, instead of ingesting the matches, let's add to a CSV file. and then I can review that table and THEN you can ingest the photometry from that table.

@kelle
Copy link
Collaborator

kelle commented Jul 1, 2025

It might be faster to write the CSV files as you go through the loop rather than using .append. This is probably most important for the successful_source list since it's the biggest.

eg,

with open('photometry_data.csv', 'w') as phot_data:
        data_writer = csv.DictWriter(phot_data, fieldnames=[blah])
        data_writer.writerows(photometry_data)
        

@ying2212
Copy link
Collaborator Author

ying2212 commented Jul 2, 2025

Things that have changed and needs review:
collectphot_PS1.py

  • save valid sources into valid_photometry.csv, and missing ones to invalid_photometry.csv
  • also maps valid source name to SIMPLE source name and saves them in matched_sources.csv for ingesting motion afterwards

ingestphot_PS1.py

  • Ingest only valid photometry data from valid_photometry.csv to speed things up.

ingestmotion_PS1.py

  • Use the matched source names to ingest_proper_motions
  • invalid_proper_motion.csv: store source with missing RA/Dec
  • valid_proper_motion.csv: store tested valid proper motions entries

@canavarrete01
Copy link
Contributor

Make sure to update branch and then your branch should be ready to be merged!

@kelle
Copy link
Collaborator

kelle commented Jul 14, 2025

Also update the PR name -- it's just photometry,
Not proper motions , correct?

And let's also update the versions table and do a release once this PR is merged.

@kelle
Copy link
Collaborator

kelle commented Jul 21, 2025

  • Update with main
  • add tests for proper motion

Comment on lines 429 to 432
# Test for Best18 proper motions added from Pan-STARRS catalog
ref = "Best18"
t = db.query(db.ProperMotions).filter(db.ProperMotions.c.reference == ref).astropy()
assert len(t) == 1966, f"found {len(t)} proper motion entries for {ref}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move both Kirk19 and Best18 proper motion test to test_data_astrometry

Copy link
Collaborator

Choose a reason for hiding this comment

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

Work with Kasey to write a test of *adopted" proper motions for Best18, Best20, and GaiaEDR3

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here's an example for parallaxes:

t = (
        db.query(db.Parallaxes)
        .filter(and_(db.Parallaxes.c.reference == ref, db.Parallaxes.c.adopted == 1))
        .astropy()
    )
    assert (
        len(t) == 1077
    ), f"found {len(t)} adopted parallax reference entries for {ref}"

@kelle
Copy link
Collaborator

kelle commented Jul 29, 2025

I think the ingestmotion script should be re-run on the updated database. Some of the adopted flags might change now that there are also CatWISE proper motions to compare to.

@ying2212
Copy link
Collaborator Author

ying2212 commented Jul 29, 2025

Yep you're right!
I've pulled the latest main version with CATWISE proper motion data ingested, and also reran all my ingesting scripts and check the pytest, the adoption numbers are updated for those references are in my latest commit

@kelle
Copy link
Collaborator

kelle commented Jul 29, 2025

Does pytest pass locally?

@ying2212
Copy link
Collaborator Author

yep! It passed locally

t = db.query(db.Parallaxes).filter(db.Parallaxes.c.reference == ref).astropy()
assert len(t) == 15, f"found {len(t)} parallax entries for {ref}"

def test_proper_motion_adopted(db):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of running the same test multiple times, try using pytest.mark.paramatrize.

@kelle
Copy link
Collaborator

kelle commented Jul 29, 2025

push the JSONs!

@kelle
Copy link
Collaborator

kelle commented Jul 29, 2025

and update the Versions table. I'm pretty sure new version is 3.3.2025.9.

Copy link
Collaborator

@kelle kelle left a comment

Choose a reason for hiding this comment

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

I think this is great!

@kelle kelle merged commit c757b3c into main Jul 30, 2025
6 checks passed
@kelle kelle deleted the Ingesting-PanSTARRS-Photometry-and-Proper-Motion branch July 30, 2025 02:44
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