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

Supernova volumetric redshift rate #140

Closed
wants to merge 8 commits into from

Conversation

elizabethswann
Copy link

Description

Test pull request

Checklist

  • Follow the Contributor Guidelines
  • Write unit tests
  • Write documentation strings
  • Assign someone from your working team to review this pull request
  • Assign someone from the infrastructure team to review this pull request

@elizabethswann elizabethswann requested a review from a team as a code owner April 17, 2020 13:04
@codecov
Copy link

codecov bot commented Apr 17, 2020

Codecov Report

Merging #140 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #140   +/-   ##
=======================================
  Coverage   98.90%   98.90%           
=======================================
  Files          18       18           
  Lines         457      457           
=======================================
  Hits          452      452           
  Misses          5        5           

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 e92ed25...ce81b81. Read the comment docs.

Copy link
Contributor

@rrjbca rrjbca left a comment

Choose a reason for hiding this comment

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

Looks like you have everything working!

Create Ia volumetric rate for a specific redshift
@skypybot
Copy link
Collaborator

skypybot commented Apr 17, 2020

Hello @elizabethswann! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 20:1: E302 expected 2 blank lines, found 1
Line 20:80: E501 line too long (95 > 79 characters)
Line 36:80: E501 line too long (96 > 79 characters)
Line 41:1: W293 blank line contains whitespace
Line 44:8: W291 trailing whitespace
Line 45:8: W291 trailing whitespace
Line 46:8: W291 trailing whitespace
Line 48:1: W293 blank line contains whitespace
Line 53:1: W293 blank line contains whitespace
Line 56:1: W293 blank line contains whitespace
Line 58:80: E501 line too long (93 > 79 characters)
Line 73:80: E501 line too long (83 > 79 characters)
Line 76:5: E265 block comment should start with '# '
Line 78:14: E225 missing whitespace around operator
Line 78:80: E501 line too long (103 > 79 characters)
Line 80:21: W292 no newline at end of file

Line 44:45: E225 missing whitespace around operator

Comment last updated at 2020-08-29 23:02:23 UTC

fix github bug
Update to required modules
Removed test file
Fix whitespace
@elizabethswann elizabethswann changed the title Test file Supernova volumetric redshift rate Apr 17, 2020
@rrjbca rrjbca added enhancement Improvement of existing feature module: supernova v0.2 hack labels Apr 17, 2020
Updated whitespace and style
Copy link
Contributor

@rrjbca rrjbca left a comment

Choose a reason for hiding this comment

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

Looks great thank you. Are you also able to write a couple of short tests for this function? You would need to create:

  • skypy/supernova/tests (directory)
  • skypy/supernova/tests/__init__.py (empty file)
  • skypy/supernova/tests/test_rate.py

And in test_rate.py you would write a function Ia_redshift_rate that runs a few simple tests. Perhaps look at test_size.py for inspiration. E.g. you could write a test that checks the units of the output are correct

.. [1] Frohmaier, C. et al. (2019), https://arxiv.org/pdf/1903.08580.pdf .
"""

rate = r0*(1+redshift)**a * units.year *(units.Mpc)**-3
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this whitespace will fix your PEP8 error. Also I think it should be units.year ** -1 is that correct?

Suggested change
rate = r0*(1+redshift)**a * units.year *(units.Mpc)**-3
rate = r0 * (1+redshift) ** a * units.year ** -1 * (units.Mpc) ** -3

from astropy import units


def Ia_redshift_rate(redshift, r0=2.27e-5, a=1.7):
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering what are these default values? Are they "standard" values? I would generally prefer them to not have defaults in most cases. They should also be documented under 'Parameters' even if it just says 'free parameters of the model'

>>> import numpy as np
>>> z = np.array([0.0,0.1,0.2])
>>> Ia_redshift_rate(z,r0=2.27e-5,a=1.7)
<Quantity [2.27000000e-05, 2.66927563e-05, 3.09480989e-05] yr / Mpc3>
Copy link
Contributor

Choose a reason for hiding this comment

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

Will probably have to update the units here as well

@rrjbca rrjbca added new feature New feature, such as a new model and removed enhancement Improvement of existing feature labels Apr 24, 2020
@rrjbca rrjbca changed the base branch from master to main February 22, 2021 13:40
@Lucia-Fonseca Lucia-Fonseca marked this pull request as draft March 24, 2022 10:54
@itrharrison
Copy link
Contributor

itrharrison commented Mar 29, 2022

Closed in favour of #540 which targets the correct branch of module/supernovae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: supernova new feature New feature, such as a new model v0.2 hack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants