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

V3 #7

Merged
merged 11 commits into from
Sep 23, 2024
Merged

V3 #7

merged 11 commits into from
Sep 23, 2024

Conversation

javierggt
Copy link
Contributor

@javierggt javierggt commented Aug 23, 2024

This PR mostly just modernizes this package. This PR does not change the information shown.

It does the following:

  • Make it a Ska package, including:
    • automated build.
    • automated linting.
    • modern setup using pyproject.toml.
    • changing the directory structure a bit.
  • rewrite make_toc.pl in python. This is a copy of the one in ac_stat, with small variations. Code could be shared between the two.
  • modernize gui_stat_reports.py, including:
    • use modern Ska names (e.g. Ska.)
    • use ska_helpers.logging
    • replace a function for binomial errors by the one in chandra_aca.star_probs (Binomial uncertainty chandra_aca#171)
    • replace uses of os.path with pathlib.
    • replace uses of Chandra.Time with CxoTime.
    • replace %-style string formats with f-strings
    • black/ruff
  • modernize guide_summarize.py
    • use standard main/get_parser structure
    • replace uses of os.path with pathlib.
    • replace uses of Chandra.Time with CxoTime.
    • black/ruff

Testing

Make symbolic links ponting from $SKA/data/gui_stat_reports and $SKA/www/ASPECT/gui_stat_reports to the current data/web directories in SKA. Remove the directories I expect to be modified:

cd $SKA/www/ASPECT_ICXC/test_review_outputs/guide_stat_reports/pr-7
mkdir data && cd data;
ln -s /proj/sot/ska/data/gui_stat_reports/19* .
ln -s /proj/sot/ska/data/gui_stat_reports/20* .
ln -s /proj/sot/ska/data/gui_stat_reports/*json .
rm 2024 2025
mkdir 2024
cd 2024
ln -s /proj/sot/ska/data/gui_stat_reports/2024/* .
rm M07 M08 Q3 Q4 S2 YEAR

cd ../../
mkdir web && cd web
ln -s $SKA/www/ASPECT/gui_stat_reports/19* .
ln -s $SKA/www/ASPECT/gui_stat_reports/20* .
rm 2024 2025
mkdir 2024
cd 2024
ln -s $SKA/www/ASPECT/gui_stat_reports/2024/* .
rm M07 M08 Q3 Q4 S2 YEAR

Run the commands almost like in the task schedule:

guide-stat-reports -v debug \
    --datadir $SKA/www/ASPECT_ICXC/test_review_outputs/guide_stat_reports/pr-7/data \
    --webdir $SKA/www/ASPECT_ICXC/test_review_outputs/guide_stat_reports/pr-7/web \
    --url /aspect/test_review_outputs/guide_stat_reports/pr-7/web
guide-stat-reports-toc \
    --webdir $SKA/www/ASPECT_ICXC/test_review_outputs/guide_stat_reports/pr-7/web
guide-stat-reports-summary \
    --datadir $SKA/www/ASPECT_ICXC/test_review_outputs/guide_stat_reports/pr-7/data \
    --webdir $SKA/www/ASPECT_ICXC/test_review_outputs/guide_stat_reports/pr-7/web

Output

- use chandra_aca.star_probs.binomial_confidence_interval
- use modern Ska package names
- use standard main/get_parser pattern (main takes no arguments)
- use ska_helpers.logging
- use argparse and a better verbosity argument
- remove global variable TASK_DATA and add corresponding command-line arg
- replaced uses of os.path with pathlib.Path
- replace %-style string formats with f-strings
Copy link
Contributor

@jeanconn jeanconn 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 we should let github be the archive of the "old" stuff and the new old_ directory is not needed.

Copy link
Contributor

@jeanconn jeanconn left a comment

Choose a reason for hiding this comment

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

This looks great for a "first pass" to modernize this package.

@javierggt javierggt merged commit 3afb8ae into master Sep 23, 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.

2 participants