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

Formatting Logging Output for Simulation #1632

Merged
merged 12 commits into from
Jun 17, 2021

Conversation

DhruvSondhi
Copy link
Contributor

@DhruvSondhi DhruvSondhi commented Jun 7, 2021

This PR aims to change the Formatting of the current Logging done in the Notebook.
Implements decimal up to 3 places in Plasma Stratification values
Better formatted output for luminosities values as well as t_inner values

Description

Some formatting changes have been done to the logging output for the simulation. Screenshots below differentiate the output, before & after the changes.

Motivation and context

Allows for a better, more digestible formatting for the logging output. Data is more readable & accessible to the User.

Screenshots

Original Logger Output:
image

New Formatted Logger Output:
image
Jupyter Notebook

image
image
Terminal

How has this been tested?

  • Testing pipeline.
  • Other.

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

@tardis-bot
Copy link
Contributor

Before a pull request is accepted, it must meet the following criteria:

  • Is the necessary information provided?
  • Is this a duplicate PR?
    • If a new PR is clearly a duplicate, ask how this PR is different from the original PR?
    • If this PR is about to be merged, close the original PR with a link to this new PR that solved the issue.
  • Does it pass existing tests and are new tests provided if required?
    • The test coverage should not decrease, and for new features should be close to 100%.
  • Is the code tidy?
    • No unnecessary print lines or code comments.

@codecov
Copy link

codecov bot commented Jun 7, 2021

Codecov Report

Merging #1632 (0c92e1b) into master (fa2925d) will increase coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1632      +/-   ##
==========================================
+ Coverage   61.84%   61.93%   +0.08%     
==========================================
  Files          62       62              
  Lines        5713     5729      +16     
==========================================
+ Hits         3533     3548      +15     
- Misses       2180     2181       +1     
Impacted Files Coverage Δ
tardis/tardis/simulation/base.py 85.16% <0.00%> (-0.47%) ⬇️
tardis/tardis/util/base.py 75.78% <0.00%> (+1.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa2925d...0c92e1b. Read the comment docs.

@DhruvSondhi DhruvSondhi requested a review from marxwillia June 7, 2021 18:36
@DhruvSondhi DhruvSondhi changed the title Formatting Logging Output for Simulation runs via Notebook Formatting Logging Output for Simulation Jun 7, 2021
@DhruvSondhi DhruvSondhi marked this pull request as draft June 8, 2021 04:02
@DhruvSondhi DhruvSondhi marked this pull request as ready for review June 8, 2021 19:56
@DhruvSondhi DhruvSondhi force-pushed the logger_formatting branch 2 times, most recently from 00a5dda to 18d31b1 Compare June 9, 2021 18:36
@DhruvSondhi DhruvSondhi requested a review from andrewfullard June 9, 2021 18:37
@DhruvSondhi
Copy link
Contributor Author

Colour & other Formatting changes can be done for the Logging output. Discussion on the same needed 🚀

@DhruvSondhi DhruvSondhi requested a review from wkerzendorf June 11, 2021 10:50
@DhruvSondhi DhruvSondhi force-pushed the logger_formatting branch 3 times, most recently from 48fbaf8 to be7adfe Compare June 14, 2021 15:12
@andrewfullard
Copy link
Contributor

Please make sure you have black running on save so that you do not fail the black PR test.

@DhruvSondhi DhruvSondhi force-pushed the logger_formatting branch 2 times, most recently from 0876f29 to 475a4ae Compare June 15, 2021 06:30
@DhruvSondhi
Copy link
Contributor Author

DhruvSondhi commented Jun 15, 2021

Changing the name of the check_simulation_env function based on the suggestions from @Rodot-, here
Changed to is_notebook() ... checks if the shell environment is Jupyter based or not

…onal checks for the environment using isinstance()
Copy link
Contributor

@Rodot- Rodot- 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 now!

@wkerzendorf
Copy link
Member

This is a draft right? it still contains the other PR stuff.

@andrewfullard andrewfullard merged commit 07a2011 into tardis-sn:master Jun 17, 2021
@DhruvSondhi DhruvSondhi deleted the logger_formatting branch June 17, 2021 15:50
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
* Formatting Logging Output for Simulation runs via Notebook

* Reverting removed import

* Fixing decimal precision for luminosity values

* Formatting changes for the Plasma Stratification values displayed

* Allowing pandas dataframe to be displayed in Notebook as well as Terminal

* Removing redundant pandas setting

* Adding import for get_ipython()

* Moving simulation environment checking to another PR & made appropriate changes

* Added some more formatting changes to other logging messages for consistency

* Renamed check_simulation_env() to is_notebook(), Added better conditional checks for the environment using isinstance()

* Formatting changed for Simulation message about no of iterations & time taken

* Added Tests for checking the logging done while running the simulation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants