Skip to content
Open

HW1 #17

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
Binary file added concentration.pdf
Binary file not shown.
Binary file added halomergerrate.pdf
Binary file not shown.
10 changes: 7 additions & 3 deletions pbhmergers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def rhocrit(self):
hubz2 = (self.overden.omega_matter0/aa**3 + self.overden.omega_lambda0) * hubble**2
#Critical density at redshift in units of kg m^-3
rhocrit = 3 * hubz2 / (8*math.pi* self.ureg.newtonian_constant_of_gravitation)
print "rhocrit = ", rhocrit
#The function print requires () around the argument
#print "rhocrit = ", rhocrit
print ("rhocrit = ", rhocrit)
return rhocrit.to_base_units()

def R200(self, mass):
Expand Down Expand Up @@ -224,7 +226,9 @@ def mergerhalflife(self,mass,threefac=True, bhmass=None):
threefac = self.threebodyratio(mass)
threefac = np.max([threefac, np.ones_like(threefac)],axis=0)
rate *= threefac
return 0.5*(mass/bhmass)/rat
#Name 'rat' is not defined. It might have been intended to be 'rate' but misspelled.
#return 0.5*(mass/bhmass)/rat
return 0.5*(mass/bhmass)/rate

def bias(self,mass):
"""The formula for halo bias in EPS theory (Mo & White 1996), eq. 13"""
Expand Down Expand Up @@ -402,4 +406,4 @@ def print_numbers():
plot_concentration_vs_mass(0)
plot_pbh_halo(0)
plot_pbh_per_mass(0)
print_numbers()
print_numbers()
Loading