diff --git a/README.md b/README.md index a900c8e..3839a15 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ See [docs/design.md](./docs/design.md) for a discussion of the package's design. To set up a Python development environment for `crcsim`: -1. Create a Python virtual environment based on Python 3.6. (Currently, support is limited to Python 3.6, because that is the version installed on the RTI Cluster, which is where we expect to deploy and run the experiments.) +1. Create a Python virtual environment based on Python 3.11. 1. Activate the virtual environment. 1. Install development dependencies with `pip install -r requirements.txt`. 1. Install `crcsim` with `pip install -e .`. The `-e` option specifies "development" mode, meaning that any changes you make to the code are recognized immediately without having to reinstall the package. diff --git a/crcsim/analysis.py b/crcsim/analysis.py index 4c24529..4a55fc4 100644 --- a/crcsim/analysis.py +++ b/crcsim/analysis.py @@ -679,7 +679,7 @@ def summarize(self): stage_counts = clinical_detections.new_state.value_counts() stage_counts.index = stage_counts.index.str.replace("CLINICAL_", "").str.lower() onset_distrib = stage_counts / len(clinical_detections) - for stage, value in onset_distrib.iteritems(): + for stage, value in onset_distrib.items(): replication_output_row[f"crc_onset_proportion_{stage}"] = value # Among all individuals who died from CRC, mean time between the onset of CRC @@ -779,7 +779,7 @@ def compute_status_arrays(self): f"Unexpected: more than one death event for person {p}" ) else: - death_age = int(death.time) + death_age = int(death.time.iloc[0]) alive = np.arange(max_age + 1) alive = np.where(alive > death_age, 0, 1) @@ -906,11 +906,11 @@ def compute_status_arrays(self): f"Unexpected: more than one clinical onset event for person {p}" ) # Clinical onset overall - clinical_detection_age = int(clinical_detection.time) + clinical_detection_age = int(clinical_detection.time.iloc[0]) clinical_onset[clinical_detection_age] = 1 # Five-year survival overall - clinical_detection_age_decimal = float(clinical_detection.time) - death_age_decimal = float(death.time) + clinical_detection_age_decimal = float(clinical_detection.time.iloc[0]) + death_age_decimal = float(death.time.iloc[0]) crc_onset_to_death = death_age_decimal - clinical_detection_age_decimal if crc_onset_to_death > 5: five_year_survival[clinical_detection_age] = 1 diff --git a/requirements.in b/requirements.in index b8eb93f..c2cf3b7 100644 --- a/requirements.in +++ b/requirements.in @@ -1,13 +1,13 @@ # Requirements needed for installing and using the package. Include # everything necessary to satisfy setup.py's install_requires section. fire -pandas +pandas==2.1.1 # Additional requirements needed for development. -black==22.8.0 +black==23.1.0 flake8==3.8.3 isort==5.2.0 -mypy==0.812 +mypy==1.4.1 pytest==5.4.3 wheel==0.34.2 pip-tools diff --git a/requirements.txt b/requirements.txt index 1bd0cf5..cdeb8d0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # -# This file is autogenerated by pip-compile -# To update, run: +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: # # pip-compile # @@ -8,7 +8,7 @@ appdirs==1.4.4 # via virtualenv attrs==19.3.0 # via pytest -black==22.8.0 +black==23.1.0 # via -r requirements.in cfgv==3.1.0 # via pre-commit @@ -16,10 +16,10 @@ click==8.0.4 # via # black # pip-tools -dataclasses==0.8 - # via black distlib==0.3.1 # via virtualenv +enum34==1.1.10 + # via fire filelock==3.0.12 # via virtualenv fire==0.3.1 @@ -28,37 +28,27 @@ flake8==3.8.3 # via -r requirements.in identify==1.4.25 # via pre-commit -importlib-metadata==1.7.0 - # via - # click - # flake8 - # pluggy - # pre-commit - # pytest - # virtualenv -importlib-resources==3.0.0 - # via - # pre-commit - # virtualenv isort==5.2.0 # via -r requirements.in mccabe==0.6.1 # via flake8 more-itertools==8.4.0 # via pytest -mypy-extensions==0.4.3 +mypy==1.4.1 + # via -r requirements.in +mypy-extensions==1.0.0 # via # black # mypy -mypy==0.812 - # via -r requirements.in nodeenv==1.4.0 # via pre-commit -numpy==1.19.1 +numpy==1.26.3 # via pandas -packaging==20.4 - # via pytest -pandas==1.1.0 +packaging==23.2 + # via + # black + # pytest +pandas==2.1.1 # via -r requirements.in pathspec==0.9.0 # via black @@ -76,11 +66,9 @@ pycodestyle==2.6.0 # via flake8 pyflakes==2.2.0 # via flake8 -pyparsing==2.4.7 - # via packaging pytest==5.4.3 # via -r requirements.in -python-dateutil==2.8.1 +python-dateutil==2.8.2 # via pandas pytz==2020.1 # via pandas @@ -89,33 +77,22 @@ pyyaml==5.3.1 six==1.15.0 # via # fire - # packaging # python-dateutil # virtualenv termcolor==1.1.0 # via fire toml==0.10.1 # via pre-commit -tomli==1.2.3 - # via black -typed-ast==1.4.3 - # via - # black - # mypy typing-extensions==4.1.1 - # via - # black - # mypy + # via mypy +tzdata==2023.4 + # via pandas virtualenv==20.0.28 # via pre-commit wcwidth==0.2.5 # via pytest wheel==0.34.2 # via -r requirements.in -zipp==3.1.0 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # pip