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

generate a diff file with differences between supplements #173

Merged
merged 8 commits into from
May 16, 2024

Conversation

javierggt
Copy link
Contributor

@javierggt javierggt commented May 15, 2024

This PR adds functionality to generate an ECSV file with the (effective) differences between supplements.

I say "effective" because, if a star is not in the supplement, then the catalog magnitude is used, so strictly speaking it is not just the difference between supplements. It is the difference in magnitude reported by agasc when using the supplement.

Description

Interface impacts

Provides a new data file intended to be used by other groups (sot mp).

Testing

Unit tests

Independent check of unit tests by Jean

  • Mac
(ska3) flame:agasc jean$ pytest
==================================================== test session starts =====================================================
platform darwin -- Python 3.10.8, pytest-8.0.2, pluggy-1.4.0
rootdir: /Users/jean/git
configfile: pytest.ini
plugins: timeout-2.2.0, anyio-3.6.2
collected 72 items                                                                                                           

agasc/tests/test_agasc_1.py .....                                                                                      [  6%]
agasc/tests/test_agasc_2.py ..........sssss..........ss...............                                                 [ 65%]
agasc/tests/test_agasc_healpix.py ...........                                                                          [ 80%]
agasc/tests/test_obs_status.py ..............                                                                          [100%]

=============================================== 65 passed, 7 skipped in 13.57s ===============================================
(ska3) flame:agasc jean$ git rev-parse HEAD
9575fc9f068361d3b236385152d0218b2c23a49c

Functional tests

Testing the diffs

Comparing between flight and RC:

python -m agasc.scripts.supplement_diff --from $SKA/data/agasc/agasc_supplement.h5 --to $SKA/data/agasc/rc/agasc_supplement.h5 -o agasc_supplement_diff.ecsv

Comparing when there are no diffs:

python -m agasc.scripts.supplement_diff --from $SKA/data/agasc/agasc_supplement.h5 --to $SKA/data/agasc/agasc_supplement.h5 -o empty.ecsv

Testing sending email

From the local repo:

export PYTHONPATH=`pwd`
mkdir -p ska/www/ASPECT/agasc/supplement
mkdir -p ska/data/agasc/rc/promote
ln -s $SKA/data/* ska/data/
cp $SKA/data/agasc/* ska/data/agasc/
export SKA=`pwd`/ska
cp ska/data/agasc/agasc_supplement.h5 ska/data/agasc/rc/promote
python -m agasc.scripts.supplement_tasks update-rc

This script fails in the last step (updating the supplement in rc) but does everything in the PR.

@jeanconn
Copy link
Contributor

My only go-back is that it seems like this should write the diffs out to date directories .

@jeanconn jeanconn merged commit 3d5deac into master May 16, 2024
1 check passed
@jeanconn jeanconn deleted the supplement-promotion-diff branch May 16, 2024 15:34
@jeanconn jeanconn mentioned this pull request May 20, 2024
@taldcroft
Copy link
Member

I completely missed this. Overall it looks good.

👍 to @jeanconn's comment to write the diffs out to date-based directories. The existing directory for the corresponding supplement report seems like a good location to me, but whatever.

@taldcroft
Copy link
Member

It's not super important but I don't understand why mag_aca_err is treated differently from mag_aca. Only the latter gets filled from the catalog if it is missing.

agasc_id mag_aca_from mag_aca_err_from last_obs_time_from mag_aca_to mag_aca_err_to last_obs_time_to mag_aca bad_star_source_from bad_star_source_to d_mag d_mag_err
...
27921360 8.840762 0.031336494 759648038.866 8.836912 0.03262599 831848273.596 8.75863 -9999 -9999 -0.0038499832 0.0012894981
27921920 8.933575 "" "" 8.970234 0.03473679 831848273.596 8.933575 -9999 -9999 0.03665924 ""

Meaning the last row could be like

27921920 8.933575 <mag_aca_err> "" 8.970234 0.03473679 831848273.596 8.933575 -9999 -9999 0.03665924 <d_mag_aca_err>

@javierggt javierggt mentioned this pull request Jun 26, 2024
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.

3 participants