Skip to content

Commit

Permalink
remove old stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
virgesmith committed Nov 1, 2024
1 parent 208384c commit 916d151
Show file tree
Hide file tree
Showing 75 changed files with 253 additions and 77,507 deletions.
4 changes: 0 additions & 4 deletions .codacy.yaml

This file was deleted.

59 changes: 30 additions & 29 deletions docs/custom_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,46 @@


class AsymptoticTimeline(neworder.Timeline):
def __init__(self) -> None:
super().__init__()
self.t = 1.0
def __init__(self) -> None:
super().__init__()
self.t = 1.0

@property
def start(self) -> float:
return 0.0
@property
def start(self) -> float:
return 0.0

@property
def end(self) -> float:
return 1.0
@property
def end(self) -> float:
return 1.0

@property
def nsteps(self) -> int:
return -1
@property
def nsteps(self) -> int:
return -1

@property
def time(self) -> float:
return 1.0 - self.t
@property
def time(self) -> float:
return 1.0 - self.t

@property
def dt(self) -> float:
return self.t / 2
@property
def dt(self) -> float:
return self.t / 2

def _next(self) -> None:
self.t /= 2
def _next(self) -> None:
self.t /= 2

@property
def at_end(self) -> bool:
return False
@property
def at_end(self) -> bool:
return False


class Model(neworder.Model):
def __init__(self) -> None:
super().__init__(AsymptoticTimeline())
def __init__(self) -> None:
super().__init__(AsymptoticTimeline())

def step(self) -> None:
neworder.log(f"{self.timeline.index}: {self.timeline.time}")
if self.timeline.time > 0.99:
self.halt()

def step(self) -> None:
neworder.log(f"{self.timeline.index}: {self.timeline.time}")
if self.timeline.time > 0.99:
self.halt()

neworder.run(Model())
4 changes: 3 additions & 1 deletion docs/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
}

# this is the overall record id, not a specific version
_NEWORDER_ZENODO_ID = 4031821 # search using this (or DOI 10.5281/zenodo.4031821) just doesnt work
_NEWORDER_ZENODO_ID = (
4031821 # search using this (or DOI 10.5281/zenodo.4031821) just doesnt work
)


@cache
Expand Down
1 change: 1 addition & 0 deletions examples/chapter1/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This is a direct neworder cover version of the Basic Cohort Model from the Belanger & Sabourin book
See https://www.microsimulationandpopulationdynamics.com/
"""

import numpy as np
from person import People

Expand Down
1 change: 1 addition & 0 deletions examples/competing/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Competing risks - fertility & mortality
"""

# model implementation
from people import People

Expand Down
4 changes: 2 additions & 2 deletions examples/daisyworld/daisyworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ def __calc_local_heating(self) -> np.ndarray[np.float64, np.dtype[np.float64]]:

# get absorbed luminosity from state
def fs(
state: np.ndarray[np.int64, np.dtype[np.int64]]
state: np.ndarray[np.int64, np.dtype[np.int64]],
) -> np.ndarray[np.float64, np.dtype[np.float64]]:
return (1.0 - self.albedo[state]) * solar_luminosity

abs_lum = fs(self.domain.state)

# get local heating from absorbed luminosity
def fl(
lum: np.ndarray[np.float64, np.dtype[np.float64]]
lum: np.ndarray[np.float64, np.dtype[np.float64]],
) -> np.ndarray[np.float64, np.dtype[np.float64]]:
return 72.0 * np.log(lum) + 80.0

Expand Down
11 changes: 10 additions & 1 deletion examples/infection/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@
# probability of dying from infection at any point during the infection
MORTALITY = 0.01

m = Infection(POINT, RADIUS, NUM_AGENTS, NUM_INFECTED, SPEED, INFECTION_RADIUS, RECOVERY_TIME, MORTALITY)
m = Infection(
POINT,
RADIUS,
NUM_AGENTS,
NUM_INFECTED,
SPEED,
INFECTION_RADIUS,
RECOVERY_TIME,
MORTALITY,
)
no.run(m)
2 changes: 1 addition & 1 deletion examples/option/black_scholes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Black-Scholes model implementations: analytic and MC """
"""Black-Scholes model implementations: analytic and MC"""

from typing import Any

Expand Down
1 change: 1 addition & 0 deletions examples/people/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
model.py: Population Microsimulation - births, deaths and migration by age, gender and ethnicity
"""

import time
from datetime import date

Expand Down
2 changes: 1 addition & 1 deletion examples/people/population.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
population.py: Model implementation for population microsimulation
population.py: Model implementation for population microsimulation
"""

import os
Expand Down
3 changes: 2 additions & 1 deletion examples/people/pyramid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" pyramid plots """
"""pyramid plots"""

from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions examples/riskpaths/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
available at www.statcan.gc.ca/microsimulation/modgen/modgen-eng.htm'
"""

from riskpaths import RiskPaths
from visualisation import plot

Expand Down
Loading

0 comments on commit 916d151

Please sign in to comment.