Skip to content

Commit

Permalink
Merge pull request #200 from amath-idm/starsim-rename
Browse files Browse the repository at this point in the history
Starsim rename
  • Loading branch information
cliffckerr authored Jan 22, 2024
2 parents ce8c520 + df61d5a commit 0c7ec70
Show file tree
Hide file tree
Showing 55 changed files with 87 additions and 80 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ All notable changes to the codebase are documented in this file. Changes that ma
:local:
:depth: 1


Version 0.1.5 (2024-01-23)
--------------------------
- Renamed ``stisim`` to ``starsim``.
- *GitHub info*: PR `200 <https://github.com/amath-idm/stisim/pull/200>`_


Version 0.1.4 (2024-01-23)
--------------------------
- Adds a syphilis module
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
STIsim
Starsim
======

STIsim is an agent-based model that captures co-transmission of STIs including HIV, HPV, chlamydia, gonorrhea, and syphilis.
Starsim is a agent-based model of disease transmission. It can be used for simulating STIs (including co-transmission of HIV, HPV, chlamydia, gonorrhea, and syphilis), respiratory infections (including tuberculosis), and other diseases (such as Ebola).

**WARNING! This library is in the early stages of development. It is being shared solely for transparency and to facilitate collaborative development. It is not ready to be used and any results produced using it will be invalid.**


Installation
------------

To install, clone this repository, then run ``pip install -e .`` (don't forget the dot!) in this folder to install ``starsim`` and its dependencies. This will make ``stisim `` available on the Python path.
To install, clone this repository, then run ``pip install -e .`` (don't forget the dot!) in this folder to install ``starsim`` and its dependencies. This will make ``starsim `` available on the Python path.
Usage and documentation
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Get version
cwd = os.path.abspath(os.path.dirname(__file__))
versionpath = os.path.join(cwd, 'stisim', 'version.py')
versionpath = os.path.join(cwd, 'starsim', 'version.py')
version = runpy.run_path(versionpath)['__version__']

# Get the documentation
Expand All @@ -25,13 +25,13 @@
]

setup(
name="stisim",
name="starsim",
version=version,
author="Romesh Abeysuriya, Robyn Stuart, Jamie Cohen, Cliff Kerr, Daniel Klein",
description="Sexually Transmitted Infections Simulator (STIsim)",
author="Robyn Stuart, Romesh Abeysuriya, Jamie Cohen, Cliff Kerr, Daniel Klein",
description="Starsim",
long_description=long_description,
long_description_content_type="text/x-rst",
keywords=["agent-based model", "simulation"],
keywords=["agent-based model", "simulation", "disease", "epidemiology"],
platforms=["OS Independent"],
classifiers=CLASSIFIERS,
packages=find_packages(),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion stisim/analyzers.py → starsim/analyzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Define analyzers
"""

import stisim as ss
import starsim as ss


__all__ = ['Analyzer']
Expand Down
2 changes: 1 addition & 1 deletion stisim/connectors.py → starsim/connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Define connections between disease modules
'''

import stisim as ss
import starsim as ss


class Connector(ss.Module):
Expand Down
2 changes: 1 addition & 1 deletion stisim/demographics.py → starsim/demographics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import numpy as np
import stisim as ss
import starsim as ss
import sciris as sc
import pandas as pd
import scipy.stats as sps
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion stisim/diseases/disease.py → starsim/diseases/disease.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
import sciris as sc
import stisim as ss
import starsim as ss
import scipy.stats as sps
import networkx as nx
from operator import itemgetter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import numpy as np
import stisim as ss
import starsim as ss
import sciris as sc
from .disease import Disease
import scipy.stats as sps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import numpy as np
import stisim as ss
import starsim as ss
from .disease import STI
import scipy.stats as sps

Expand Down
2 changes: 1 addition & 1 deletion stisim/diseases/hiv.py → starsim/diseases/hiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import numpy as np
import sciris as sc
import stisim as ss
import starsim as ss
from .disease import STI
import scipy.stats as sps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sciris import randround as rr
import scipy.stats as sps

import stisim as ss
import starsim as ss
from .disease import STI

__all__ = ['Syphilis']
Expand Down
6 changes: 3 additions & 3 deletions stisim/distributions.py → starsim/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"""

import numpy as np
from stisim.utils import INT_NAN
from stisim.random import SingleRNG, MultiRNG
from stisim import options, int_
from starsim.utils import INT_NAN
from starsim.random import SingleRNG, MultiRNG
from starsim import options, int_
from copy import deepcopy
from scipy.stats._discrete_distns import bernoulli_gen
from scipy.stats import rv_histogram
Expand Down
2 changes: 1 addition & 1 deletion stisim/interventions.py → starsim/interventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Define interventions
"""

import stisim as ss
import starsim as ss
import sciris as sc
import numpy as np
import pandas as pd
Expand Down
2 changes: 1 addition & 1 deletion stisim/modules.py → starsim/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'''

import sciris as sc
import stisim as ss
import starsim as ss
from scipy.stats._distn_infrastructure import rv_frozen

__all__ = ['Module']
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions stisim/networks/networks.py → starsim/networks/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# %% Imports
import numpy as np
import sciris as sc
import stisim as ss
import starsim as ss
import scipy.optimize as spo
import scipy.stats as sps
import scipy.spatial as spsp
Expand Down Expand Up @@ -889,18 +889,18 @@ def add_pairs(self, mother_inds, unborn_inds, dur):
class static(Network):
"""
A network class of static partnerships converted from a networkx graph. There's no formation of new partnerships
and initialized partnerships only end when one of the partners dies. The networkx graph can be created outside STIsim
if population size is known. Or the graph can be created by passing a networkx generator function to STIsim.
and initialized partnerships only end when one of the partners dies. The networkx graph can be created outside Starsim
if population size is known. Or the graph can be created by passing a networkx generator function to Starsim.
**Examples**::
# Generate a networkx graph and pass to STIsim
# Generate a networkx graph and pass to Starsim
import networkx as nx
import stisim as ss
import starsim as ss
g = nx.scale_free_graph(n=10000)
ss.static(graph=g)
# Pass a networkx graph generator to STIsim
# Pass a networkx graph generator to Starsim
ss.static(graph=nx.erdos_renyi_graph, p=0.0001)
"""
Expand Down
2 changes: 1 addition & 1 deletion stisim/networks/randnet.py → starsim/networks/randnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Random networks"""

import stisim as ss
import starsim as ss
import numpy as np
import numba as nb
from .networks import Network
Expand Down
2 changes: 1 addition & 1 deletion stisim/parameters.py → starsim/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import sciris as sc
import stisim as ss
import starsim as ss


__all__ = ['Parameters', 'make_pars']
Expand Down
2 changes: 1 addition & 1 deletion stisim/people.py → starsim/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import pandas as pd
import sciris as sc
import stisim as ss
import starsim as ss
import scipy.stats as sps

__all__ = ['BasePeople', 'People']
Expand Down
4 changes: 2 additions & 2 deletions stisim/random.py → starsim/random.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hashlib
import numpy as np
import stisim as ss
import starsim as ss

__all__ = ['RNGContainer', 'MultiRNG', 'SingleRNG', 'RNG']

Expand Down Expand Up @@ -106,7 +106,7 @@ class MultiRNG(np.random.Generator):
rng and ultimately ask for randomly distributed random numbers for agents
with UIDs 1 and 4:
>>> import stisim as ss
>>> import starsim as ss
>>> import numpy as np
>>> rng = ss.MultiRNG('Test') # The hashed name determines the seed offset.
>>> rng.initialize(container=None, slots=5) # In practice, slots will be sim.people.slots. When scalar (for testing), an np.arange will be used.
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 9 additions & 9 deletions stisim/settings.py → starsim/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Define options for STIsim.
Define options for Starsim.
All options should be set using set() or directly, e.g.::
ss.options(verbose=False)
Expand All @@ -16,7 +16,7 @@
# Not public to avoid confusion with ss.options
class Options(sc.objdict):
"""
Set options for STIsim.
Set options for Starsim.
Use ``ss.options.set('defaults')`` to reset all values to default, or ``ss.options.set(dpi='default')``
to reset one parameter to default. See ``ss.options.help(detailed=True)`` for
Expand Down Expand Up @@ -48,7 +48,7 @@ def __init__(self):
@staticmethod
def get_orig_options():
"""
Set the default options for STIsim -- not to be called by the user, use
Set the default options for Starsim -- not to be called by the user, use
``ss.options.set('defaults')`` instead.
"""

Expand All @@ -63,16 +63,16 @@ def get_orig_options():
options.multirng = False

optdesc.verbose = 'Set default level of verbosity (i.e. logging detail): e.g., 0.1 is an update every 10 simulated timesteps.'
options.verbose = float(os.getenv('STISIM_VERBOSE', 0.1))
options.verbose = float(os.getenv('STARSIM_VERBOSE', 0.1))

optdesc.warnings = 'How warnings are handled: options are "warn" (default), "print", and "error"'
options.warnings = str(os.getenv('STISIM_WARNINGS', 'warn'))
options.warnings = str(os.getenv('STARSIM_WARNINGS', 'warn'))

optdesc.sep = 'Set thousands seperator for text output'
options.sep = str(os.getenv('STISIM_SEP', ','))
options.sep = str(os.getenv('STARSIM_SEP', ','))

optdesc.precision = 'Set arithmetic precision -- 32-bit by default for efficiency'
options.precision = int(os.getenv('STISIM_PRECISION', 32))
options.precision = int(os.getenv('STARSIM_PRECISION', 32))

return optdesc, options

Expand All @@ -84,7 +84,7 @@ def __call__(self, *args, **kwargs):
def __repr__(self):
""" Brief representation """
output = sc.objectid(self)
output += 'STIsim options (see also ss.options.disp()):\n'
output += 'Starsim options (see also ss.options.disp()):\n'
output += sc.pp(self.to_dict(), output=True)
return output

Expand All @@ -108,7 +108,7 @@ def __exit__(self, *args, **kwargs):

def disp(self):
""" Detailed representation """
output = 'STIsim options (see also ss.options.help()):\n'
output = 'Starsim options (see also ss.options.help()):\n'
keylen = 10 # Maximum key length -- "interactive"
for k, v in self.items():
keystr = sc.colorize(f' {k:>{keylen}s}: ', fg='cyan', output=True)
Expand Down
4 changes: 2 additions & 2 deletions stisim/sim.py → starsim/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Imports
import numpy as np
import sciris as sc
import stisim as ss
import starsim as ss
import itertools
import numba as nb

Expand Down Expand Up @@ -134,7 +134,7 @@ def validate_pars(self):
# Handle n_agents
if self.people is not None:
self.pars['n_agents'] = len(self.people)
#elif self.popdict is not None: # STIsim does not currenlty support self.popdict
#elif self.popdict is not None: # Starsim does not currenlty support self.popdict
#self.pars['n_agents'] = len(self.popdict)
elif self.pars['n_agents'] is not None:
self.pars['n_agents'] = int(self.pars['n_agents'])
Expand Down
6 changes: 3 additions & 3 deletions stisim/states.py → starsim/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import numpy as np
import sciris as sc
import numba as nb
from stisim.utils import INT_NAN
from stisim.distributions import ScipyDistribution
from stisim.utils import warn
from starsim.utils import INT_NAN
from starsim.distributions import ScipyDistribution
from starsim.utils import warn
from numpy.lib.mixins import NDArrayOperatorsMixin # Inherit from this to automatically gain operators like +, -, ==, <, etc.
from scipy.stats._distn_infrastructure import rv_frozen

Expand Down
2 changes: 1 addition & 1 deletion stisim/utils.py → starsim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import warnings
import numpy as np
import sciris as sc
import stisim as ss
import starsim as ss
import numba as nb
import scipy.stats as sps
import pandas as pd
Expand Down
2 changes: 1 addition & 1 deletion stisim/version.py → starsim/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

__all__ = ['__version__', '__versiondate__', '__license__']

__version__ = '0.1.4'
__version__ = '0.1.5'
__versiondate__ = '2024-01-23'
__license__ = f'STIsim {__version__} ({__versiondate__}) — © 2024 by IDM'
2 changes: 1 addition & 1 deletion tests/.coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# .coveragerc to control coverage.py
[run]
branch = True
source = stisim
source = starsim

[report]
# Regexes for lines to exclude from consideration
Expand Down
2 changes: 1 addition & 1 deletion tests/check_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export SCIRIS_BACKEND='agg' # Don't open up figures

echo 'Running tests...'
pytest -v test_*.py -n auto --cov-config=.coveragerc --cov=../stisim --durations=0
pytest -v test_*.py -n auto --cov-config=.coveragerc --cov=../starsim --durations=0

echo 'Creating HTML report...'
coverage html
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Fixtures defined in this file will be used by all tests

import stisim as ss
import starsim as ss
import pytest

# Run all tests with both single and multi RNG streams
Expand Down
2 changes: 1 addition & 1 deletion tests/devtests/devtest_art_impact_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

# %% Imports and settings
import stisim as ss
import starsim as ss
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion tests/devtests/devtest_births.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

# %% Imports and settings
import stisim as ss
import starsim as ss
import matplotlib.pyplot as plt
import pandas as pd

Expand Down
Loading

0 comments on commit 0c7ec70

Please sign in to comment.