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

phase curve plot func #114

Merged
merged 3 commits into from
May 14, 2024
Merged

phase curve plot func #114

merged 3 commits into from
May 14, 2024

Conversation

jrob93
Copy link
Collaborator

@jrob93 jrob93 commented May 7, 2024

Fixes #112.

This is a start at adding some plotting utility functions, e.g. making phase curve plots from adler objects. I have tried to write this such that a matplotlib figure object is returned by the function, this can either be displayed or manipulated further.

Review Checklist for Source Code Changes

  • Does pip install still work?
  • Have you written a unit test for any new functions?
  • Do all the units tests run successfully?
  • Does adler run successfully on a test set of input files/databases?
  • Have you used black on the files you have updated to confirm python programming style guide enforcement?

@jrob93 jrob93 self-assigned this May 7, 2024
@jrob93 jrob93 linked an issue May 7, 2024 that may be closed by this pull request
@jrob93
Copy link
Collaborator Author

jrob93 commented May 7, 2024

If this approach looks sensible I would like to add more plotting functions and improve the demo notebook notebooks/plotting_utilities.ipynb (and add unit tests of course)

jrob93 added 2 commits May 13, 2024 22:11
Merge branch 'main' into 112-plotting-utilities
Copy link
Collaborator

@astronomerritt astronomerritt 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 good to me. Looks like it'll be fairly simple to add more plotting functions. Seems very flexible too.

Regarding your comment on Slack: this does need to be unit-tested! I will approve without the unit test but here is how I would do it:

  • Run the function several times testing each if-statement (so one that uses label_list, one that uses col_list, one accepting fig as an argument). You don't have to check the resultant plots - the aim of the unit test is to make sure that no errors trigger when the function is called. That way, if anything changes in the code that would break plotting entirely, we'll know.
  • Create a plot using savefig then check that it exists where you told it to save using os.path.exists(). Using pytest's tmp_path functionality is helpful here to direct output of tests to a temporary location. You can see how that's done in test_AdlerData.py in the test test_write_row_to_database().

@jrob93 jrob93 mentioned this pull request May 14, 2024
@jrob93 jrob93 merged commit c67e289 into main May 14, 2024
10 checks passed
@jrob93 jrob93 deleted the 112-plotting-utilities branch May 14, 2024 12:31
@jrob93 jrob93 mentioned this pull request May 22, 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.

Plotting utilities
2 participants