Supernova volumetric redshift rate#140
Supernova volumetric redshift rate#140elizabethswann wants to merge 8 commits intoskypyproject:mainfrom
Conversation
Codecov Report
@@ 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.
|
Create Ia volumetric rate for a specific redshift
|
Hello @elizabethswann! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-08-29 23:02:23 UTC |
fix github bug
Update to required modules
Removed test file
Fix whitespace
Updated whitespace and style
rrjbca
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
I think this whitespace will fix your PEP8 error. Also I think it should be units.year ** -1 is that correct?
| 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): |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
Will probably have to update the units here as well
|
Closed in favour of #540 which targets the correct branch of |
Description
Test pull request
Checklist