Datasets:
Tasks:
Tabular Classification
Formats:
parquet
Languages:
English
Size:
< 1K
Tags:
economics
quantitative-finance
causal-inference
macroeconomics
housing-economics
market-microstructure
License:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- CasualLab/.venv/bin/activate +76 -0
- CasualLab/.venv/bin/activate.csh +27 -0
- CasualLab/.venv/bin/casuallab +10 -0
- CasualLab/.venv/bin/coverage +10 -0
- CasualLab/.venv/bin/coverage-3.12 +10 -0
- CasualLab/.venv/bin/jsonschema +10 -0
- CasualLab/.venv/bin/normalizer +10 -0
- CasualLab/.venv/bin/numpy-config +10 -0
- CasualLab/.venv/bin/pip +10 -0
- CasualLab/.venv/bin/py.test +10 -0
- CasualLab/.venv/bin/pygmentize +10 -0
- CasualLab/.venv/bin/python3.12 +0 -0
- CasualLab/.venv/bin/uvicorn +10 -0
- CasualLab/.venv/etc/jupyter/nbconfig/notebook.d/pydeck.json +5 -0
- CasualLab/.venv/lib/python3.12/site-packages/py.py +15 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/_compat.pxd +10 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/_context.pyi +7 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/_crs.pyx +3236 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/_geod.pyi +83 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/_transformer.pxd +26 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/_version.pyi +4 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/enums.py +173 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/list.pyx +57 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/proj.pxi +566 -0
- CasualLab/.venv/lib/python3.12/site-packages/pyproj/sync.py +280 -0
- CasualLab/.venv/lib/python3.12/site-packages/shapefile.py +0 -0
- CasualLab/.venv/lib/python3.12/site-packages/six.py +1003 -0
- CasualLab/.venv/lib/python3.12/site-packages/threadpoolctl.py +1292 -0
- CasualLab/.venv/lib/python3.12/site-packages/typing_extensions.py +0 -0
- CasualLab/artifacts/benchmarks/equilibrium/ledger.csv +3 -0
- CasualLab/artifacts/benchmarks/equilibrium/manifest.json +45 -0
- CasualLab/artifacts/benchmarks/equilibrium/summary.json +119 -0
- CasualLab/artifacts/benchmarks/equilibrium/zone_effects.csv +3 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_calibration_by_score.csv +6 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_calibration_chart.html +42 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_feature_importance.csv +6 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_fold_stability.csv +5 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_predictions.csv +385 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_recovery.json +21 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_subgroup_recovery.csv +5 -0
- CasualLab/artifacts/benchmarks/heterogeneity/hte_subgroups.csv +5 -0
- CasualLab/artifacts/benchmarks/heterogeneity/manifest.json +91 -0
- CasualLab/artifacts/benchmarks/interference_manifest.json +63 -0
- CasualLab/artifacts/benchmarks/monte_carlo_records.csv +0 -0
- CasualLab/artifacts/benchmarks/nyc_graph/failures.csv +1 -0
- CasualLab/artifacts/benchmarks/nyc_graph/fit_ledger.csv +5 -0
- CasualLab/artifacts/benchmarks/nyc_graph/manifest.json +92 -0
- CasualLab/artifacts/benchmarks/nyc_graph/metadata.json +229 -0
- CasualLab/artifacts/benchmarks/nyc_graph/records.csv +49 -0
- CasualLab/artifacts/benchmarks/nyc_graph/summary.csv +5 -0
CasualLab/.venv/bin/activate
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source bin/activate" *from bash*
|
| 2 |
+
# You cannot run it directly
|
| 3 |
+
|
| 4 |
+
deactivate () {
|
| 5 |
+
# reset old environment variables
|
| 6 |
+
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
| 7 |
+
PATH="${_OLD_VIRTUAL_PATH:-}"
|
| 8 |
+
export PATH
|
| 9 |
+
unset _OLD_VIRTUAL_PATH
|
| 10 |
+
fi
|
| 11 |
+
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
| 12 |
+
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
| 13 |
+
export PYTHONHOME
|
| 14 |
+
unset _OLD_VIRTUAL_PYTHONHOME
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
# Call hash to forget past locations. Without forgetting
|
| 18 |
+
# past locations the $PATH changes we made may not be respected.
|
| 19 |
+
# See "man bash" for more details. hash is usually a builtin of your shell
|
| 20 |
+
hash -r 2> /dev/null
|
| 21 |
+
|
| 22 |
+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
| 23 |
+
PS1="${_OLD_VIRTUAL_PS1:-}"
|
| 24 |
+
export PS1
|
| 25 |
+
unset _OLD_VIRTUAL_PS1
|
| 26 |
+
fi
|
| 27 |
+
|
| 28 |
+
unset VIRTUAL_ENV
|
| 29 |
+
unset VIRTUAL_ENV_PROMPT
|
| 30 |
+
if [ ! "${1:-}" = "nondestructive" ] ; then
|
| 31 |
+
# Self destruct!
|
| 32 |
+
unset -f deactivate
|
| 33 |
+
fi
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# unset irrelevant variables
|
| 37 |
+
deactivate nondestructive
|
| 38 |
+
|
| 39 |
+
# on Windows, a path can contain colons and backslashes and has to be converted:
|
| 40 |
+
case "$(uname)" in
|
| 41 |
+
CYGWIN*|MSYS*|MINGW*)
|
| 42 |
+
# transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
|
| 43 |
+
# and to /cygdrive/d/path/to/venv on Cygwin
|
| 44 |
+
VIRTUAL_ENV=$(cygpath '/Users/shawn/Documents/intern projects/CasualLab/.venv')
|
| 45 |
+
export VIRTUAL_ENV
|
| 46 |
+
;;
|
| 47 |
+
*)
|
| 48 |
+
# use the path as-is
|
| 49 |
+
export VIRTUAL_ENV='/Users/shawn/Documents/intern projects/CasualLab/.venv'
|
| 50 |
+
;;
|
| 51 |
+
esac
|
| 52 |
+
|
| 53 |
+
_OLD_VIRTUAL_PATH="$PATH"
|
| 54 |
+
PATH="$VIRTUAL_ENV/"bin":$PATH"
|
| 55 |
+
export PATH
|
| 56 |
+
|
| 57 |
+
VIRTUAL_ENV_PROMPT='(.venv) '
|
| 58 |
+
export VIRTUAL_ENV_PROMPT
|
| 59 |
+
|
| 60 |
+
# unset PYTHONHOME if set
|
| 61 |
+
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
| 62 |
+
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
| 63 |
+
if [ -n "${PYTHONHOME:-}" ] ; then
|
| 64 |
+
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
| 65 |
+
unset PYTHONHOME
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
| 69 |
+
_OLD_VIRTUAL_PS1="${PS1:-}"
|
| 70 |
+
PS1="("'(.venv) '") ${PS1:-}"
|
| 71 |
+
export PS1
|
| 72 |
+
fi
|
| 73 |
+
|
| 74 |
+
# Call hash to forget past commands. Without forgetting
|
| 75 |
+
# past commands the $PATH changes we made may not be respected
|
| 76 |
+
hash -r 2> /dev/null
|
CasualLab/.venv/bin/activate.csh
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file must be used with "source bin/activate.csh" *from csh*.
|
| 2 |
+
# You cannot run it directly.
|
| 3 |
+
|
| 4 |
+
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
| 5 |
+
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
| 6 |
+
|
| 7 |
+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
| 8 |
+
|
| 9 |
+
# Unset irrelevant variables.
|
| 10 |
+
deactivate nondestructive
|
| 11 |
+
|
| 12 |
+
setenv VIRTUAL_ENV '/Users/shawn/Documents/intern projects/CasualLab/.venv'
|
| 13 |
+
|
| 14 |
+
set _OLD_VIRTUAL_PATH="$PATH"
|
| 15 |
+
setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
set _OLD_VIRTUAL_PROMPT="$prompt"
|
| 19 |
+
|
| 20 |
+
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
| 21 |
+
set prompt = '(.venv) '"$prompt"
|
| 22 |
+
setenv VIRTUAL_ENV_PROMPT '(.venv) '
|
| 23 |
+
endif
|
| 24 |
+
|
| 25 |
+
alias pydoc python -m pydoc
|
| 26 |
+
|
| 27 |
+
rehash
|
CasualLab/.venv/bin/casuallab
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from casuallab.cli import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/bin/coverage
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from coverage.cmdline import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/bin/coverage-3.12
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from coverage.cmdline import main_deprecated
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main_deprecated())
|
CasualLab/.venv/bin/jsonschema
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from jsonschema.cli import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/bin/normalizer
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from charset_normalizer.cli import cli_detect
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(cli_detect())
|
CasualLab/.venv/bin/numpy-config
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from numpy._configtool import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/bin/pip
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from pip._internal.cli.main import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/bin/py.test
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from _pytest.config import _console_main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(_console_main())
|
CasualLab/.venv/bin/pygmentize
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from pygments.cmdline import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/bin/python3.12
ADDED
|
Binary file (50 kB). View file
|
|
|
CasualLab/.venv/bin/uvicorn
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
'''exec' "/Users/shawn/Documents/intern projects/CasualLab/.venv/bin/python3" "$0" "$@"
|
| 3 |
+
' '''
|
| 4 |
+
# -*- coding: utf-8 -*-
|
| 5 |
+
import re
|
| 6 |
+
import sys
|
| 7 |
+
from uvicorn.main import main
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
CasualLab/.venv/etc/jupyter/nbconfig/notebook.d/pydeck.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"load_extensions": {
|
| 3 |
+
"pydeck/extension": true
|
| 4 |
+
}
|
| 5 |
+
}
|
CasualLab/.venv/lib/python3.12/site-packages/py.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# shim for pylib going away
|
| 2 |
+
# if pylib is installed this file will get skipped
|
| 3 |
+
# (`py/__init__.py` has higher precedence)
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import sys
|
| 7 |
+
|
| 8 |
+
import _pytest._py.error as error
|
| 9 |
+
import _pytest._py.path as path
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
sys.modules["py.error"] = error
|
| 13 |
+
sys.modules["py.path"] = path
|
| 14 |
+
|
| 15 |
+
__all__ = ["error", "path"]
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/_compat.pxd
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef str cstrdecode(const char *instring)
|
| 2 |
+
cpdef bytes cstrencode(str pystr)
|
| 3 |
+
|
| 4 |
+
IF CTE_PYTHON_IMPLEMENTATION == "CPython":
|
| 5 |
+
from cpython cimport array
|
| 6 |
+
cdef array.array empty_array(int npts)
|
| 7 |
+
|
| 8 |
+
ELSE:
|
| 9 |
+
# https://github.com/pyproj4/pyproj/issues/854
|
| 10 |
+
cdef empty_array(int npts)
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/_context.pyi
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def get_user_data_dir(create: bool = False) -> str: ...
|
| 2 |
+
def _set_context_data_dir() -> None: ...
|
| 3 |
+
def _set_context_ca_bundle_path(ca_bundle_path: str) -> None: ...
|
| 4 |
+
def _set_context_network_enabled() -> None: ...
|
| 5 |
+
def set_use_global_context(active: bool | None = None) -> None: ...
|
| 6 |
+
def _clear_proj_error() -> None: ...
|
| 7 |
+
def _get_proj_error() -> str: ...
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/_crs.pyx
ADDED
|
@@ -0,0 +1,3236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import re
|
| 3 |
+
import warnings
|
| 4 |
+
from collections import OrderedDict, namedtuple
|
| 5 |
+
|
| 6 |
+
from pyproj._compat cimport cstrdecode, cstrencode
|
| 7 |
+
from pyproj._context cimport _clear_proj_error, pyproj_context_create
|
| 8 |
+
|
| 9 |
+
from pyproj._context import get_context_manager
|
| 10 |
+
from pyproj.aoi import AreaOfUse
|
| 11 |
+
from pyproj.crs.datum import CustomEllipsoid
|
| 12 |
+
from pyproj.crs.enums import CoordinateOperationType, DatumType
|
| 13 |
+
from pyproj.enums import ProjVersion, WktVersion
|
| 14 |
+
from pyproj.exceptions import CRSError
|
| 15 |
+
from pyproj.geod import pj_ellps
|
| 16 |
+
from pyproj.utils import NumpyEncoder
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# This is for looking up the ellipsoid parameters
|
| 20 |
+
# based on the long name
|
| 21 |
+
cdef dict _PJ_ELLPS_NAME_MAP = {
|
| 22 |
+
ellps["description"]: ellps_id for ellps_id, ellps in pj_ellps.items()
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
cdef str decode_or_undefined(const char* instring):
|
| 27 |
+
pystr = cstrdecode(instring)
|
| 28 |
+
if pystr is None:
|
| 29 |
+
return "undefined"
|
| 30 |
+
return pystr
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def is_wkt(str proj_string not None):
|
| 34 |
+
"""
|
| 35 |
+
.. versionadded:: 2.0.0
|
| 36 |
+
|
| 37 |
+
Check if the input projection string is in the Well-Known Text format.
|
| 38 |
+
|
| 39 |
+
Parameters
|
| 40 |
+
----------
|
| 41 |
+
proj_string: str
|
| 42 |
+
The projection string.
|
| 43 |
+
|
| 44 |
+
Returns
|
| 45 |
+
-------
|
| 46 |
+
bool: True if the string is in the Well-Known Text format
|
| 47 |
+
"""
|
| 48 |
+
cdef bytes b_proj_string = cstrencode(proj_string)
|
| 49 |
+
return proj_context_guess_wkt_dialect(NULL, b_proj_string) != PJ_GUESSED_NOT_WKT
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def is_proj(str proj_string not None):
|
| 53 |
+
"""
|
| 54 |
+
.. versionadded:: 2.2.2
|
| 55 |
+
|
| 56 |
+
Check if the input projection string is in the PROJ format.
|
| 57 |
+
|
| 58 |
+
Parameters
|
| 59 |
+
----------
|
| 60 |
+
proj_string: str
|
| 61 |
+
The projection string.
|
| 62 |
+
|
| 63 |
+
Returns
|
| 64 |
+
-------
|
| 65 |
+
bool: True if the string is in the PROJ format
|
| 66 |
+
"""
|
| 67 |
+
return not is_wkt(proj_string) and "=" in proj_string
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
cdef _to_wkt(
|
| 71 |
+
PJ_CONTEXT* context,
|
| 72 |
+
PJ* projobj,
|
| 73 |
+
object version,
|
| 74 |
+
bint pretty,
|
| 75 |
+
bool output_axis_rule=None,
|
| 76 |
+
):
|
| 77 |
+
"""
|
| 78 |
+
Convert a PJ object to a wkt string.
|
| 79 |
+
|
| 80 |
+
Parameters
|
| 81 |
+
----------
|
| 82 |
+
context: PJ_CONTEXT*
|
| 83 |
+
projobj: PJ*
|
| 84 |
+
wkt_out_type: PJ_WKT_TYPE
|
| 85 |
+
pretty: bool
|
| 86 |
+
output_axis_rule: bool or None
|
| 87 |
+
|
| 88 |
+
Return
|
| 89 |
+
------
|
| 90 |
+
str or None
|
| 91 |
+
"""
|
| 92 |
+
# get the output WKT format
|
| 93 |
+
supported_wkt_types = {
|
| 94 |
+
WktVersion.WKT2_2015: PJ_WKT2_2015,
|
| 95 |
+
WktVersion.WKT2_2015_SIMPLIFIED: PJ_WKT2_2015_SIMPLIFIED,
|
| 96 |
+
WktVersion.WKT2_2018: PJ_WKT2_2019,
|
| 97 |
+
WktVersion.WKT2_2018_SIMPLIFIED: PJ_WKT2_2019_SIMPLIFIED,
|
| 98 |
+
WktVersion.WKT2_2019: PJ_WKT2_2019,
|
| 99 |
+
WktVersion.WKT2_2019_SIMPLIFIED: PJ_WKT2_2019_SIMPLIFIED,
|
| 100 |
+
WktVersion.WKT1_GDAL: PJ_WKT1_GDAL,
|
| 101 |
+
WktVersion.WKT1_ESRI: PJ_WKT1_ESRI
|
| 102 |
+
}
|
| 103 |
+
cdef PJ_WKT_TYPE wkt_out_type
|
| 104 |
+
wkt_out_type = supported_wkt_types[WktVersion.create(version)]
|
| 105 |
+
|
| 106 |
+
cdef const char* options_wkt[3]
|
| 107 |
+
cdef bytes multiline = b"MULTILINE=NO"
|
| 108 |
+
if pretty:
|
| 109 |
+
multiline = b"MULTILINE=YES"
|
| 110 |
+
cdef bytes output_axis = b"OUTPUT_AXIS=AUTO"
|
| 111 |
+
if output_axis_rule is False:
|
| 112 |
+
output_axis = b"OUTPUT_AXIS=NO"
|
| 113 |
+
elif output_axis_rule is True:
|
| 114 |
+
output_axis = b"OUTPUT_AXIS=YES"
|
| 115 |
+
options_wkt[0] = multiline
|
| 116 |
+
options_wkt[1] = output_axis
|
| 117 |
+
options_wkt[2] = NULL
|
| 118 |
+
cdef const char* proj_string
|
| 119 |
+
proj_string = proj_as_wkt(
|
| 120 |
+
context,
|
| 121 |
+
projobj,
|
| 122 |
+
wkt_out_type,
|
| 123 |
+
options_wkt,
|
| 124 |
+
)
|
| 125 |
+
_clear_proj_error()
|
| 126 |
+
return cstrdecode(proj_string)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
cdef _to_proj4(
|
| 130 |
+
PJ_CONTEXT* context,
|
| 131 |
+
PJ* projobj,
|
| 132 |
+
object version,
|
| 133 |
+
bint pretty,
|
| 134 |
+
):
|
| 135 |
+
"""
|
| 136 |
+
Convert the projection to a PROJ string.
|
| 137 |
+
|
| 138 |
+
Parameters
|
| 139 |
+
----------
|
| 140 |
+
context: PJ_CONTEXT*
|
| 141 |
+
projobj: PJ*
|
| 142 |
+
version: pyproj.enums.ProjVersion
|
| 143 |
+
The version of the PROJ string output.
|
| 144 |
+
pretty: bool
|
| 145 |
+
|
| 146 |
+
Returns
|
| 147 |
+
-------
|
| 148 |
+
str: The PROJ string.
|
| 149 |
+
"""
|
| 150 |
+
# get the output PROJ string format
|
| 151 |
+
supported_prj_types = {
|
| 152 |
+
ProjVersion.PROJ_4: PJ_PROJ_4,
|
| 153 |
+
ProjVersion.PROJ_5: PJ_PROJ_5,
|
| 154 |
+
}
|
| 155 |
+
cdef PJ_PROJ_STRING_TYPE proj_out_type
|
| 156 |
+
proj_out_type = supported_prj_types[ProjVersion.create(version)]
|
| 157 |
+
|
| 158 |
+
cdef const char* options[2]
|
| 159 |
+
cdef bytes multiline = b"MULTILINE=NO"
|
| 160 |
+
if pretty:
|
| 161 |
+
multiline = b"MULTILINE=YES"
|
| 162 |
+
options[0] = multiline
|
| 163 |
+
options[1] = NULL
|
| 164 |
+
|
| 165 |
+
# convert projection to string
|
| 166 |
+
cdef const char* proj_string
|
| 167 |
+
proj_string = proj_as_proj_string(
|
| 168 |
+
context,
|
| 169 |
+
projobj,
|
| 170 |
+
proj_out_type,
|
| 171 |
+
options,
|
| 172 |
+
)
|
| 173 |
+
_clear_proj_error()
|
| 174 |
+
return cstrdecode(proj_string)
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
cdef tuple _get_concatenated_operations(
|
| 178 |
+
PJ_CONTEXT* context, PJ* concatenated_operation
|
| 179 |
+
):
|
| 180 |
+
"""
|
| 181 |
+
For a PJ* of type concatenated operation, get the operations
|
| 182 |
+
"""
|
| 183 |
+
cdef int step_count = proj_concatoperation_get_step_count(
|
| 184 |
+
context,
|
| 185 |
+
concatenated_operation,
|
| 186 |
+
)
|
| 187 |
+
cdef PJ* operation = NULL
|
| 188 |
+
cdef PJ_CONTEXT* sub_context = NULL
|
| 189 |
+
cdef int iii = 0
|
| 190 |
+
operations = []
|
| 191 |
+
for iii in range(step_count):
|
| 192 |
+
sub_context = pyproj_context_create()
|
| 193 |
+
operation = proj_concatoperation_get_step(
|
| 194 |
+
sub_context,
|
| 195 |
+
concatenated_operation,
|
| 196 |
+
iii,
|
| 197 |
+
)
|
| 198 |
+
operations.append(CoordinateOperation.create(sub_context, operation))
|
| 199 |
+
_clear_proj_error()
|
| 200 |
+
return tuple(operations)
|
| 201 |
+
|
| 202 |
+
cdef PJ * _from_name(
|
| 203 |
+
PJ_CONTEXT* context,
|
| 204 |
+
str name_string,
|
| 205 |
+
str auth_name,
|
| 206 |
+
PJ_TYPE pj_type,
|
| 207 |
+
):
|
| 208 |
+
"""
|
| 209 |
+
Create an object from a name.
|
| 210 |
+
|
| 211 |
+
Parameters
|
| 212 |
+
----------
|
| 213 |
+
context: PJ_CONTEXT*
|
| 214 |
+
The context to use to create the object.
|
| 215 |
+
name_string: str
|
| 216 |
+
Name of object to create.
|
| 217 |
+
auth_name: str
|
| 218 |
+
The authority name to refine search.
|
| 219 |
+
If None, will search all authorities.
|
| 220 |
+
pj_type: PJ_TYPE
|
| 221 |
+
The type of PJ * to create.
|
| 222 |
+
|
| 223 |
+
Returns
|
| 224 |
+
-------
|
| 225 |
+
PJ *
|
| 226 |
+
"""
|
| 227 |
+
cdef PJ_TYPE[1] pj_types = [pj_type]
|
| 228 |
+
cdef char* c_auth_name = NULL
|
| 229 |
+
cdef bytes b_auth_name
|
| 230 |
+
if auth_name is not None:
|
| 231 |
+
b_auth_name = cstrencode(auth_name)
|
| 232 |
+
c_auth_name = b_auth_name
|
| 233 |
+
|
| 234 |
+
cdef PJ_OBJ_LIST *pj_list = proj_create_from_name(
|
| 235 |
+
context,
|
| 236 |
+
c_auth_name,
|
| 237 |
+
cstrencode(name_string),
|
| 238 |
+
<PJ_TYPE*>&pj_types,
|
| 239 |
+
1,
|
| 240 |
+
False,
|
| 241 |
+
1,
|
| 242 |
+
NULL,
|
| 243 |
+
)
|
| 244 |
+
if pj_list == NULL or proj_list_get_count(pj_list) <= 0:
|
| 245 |
+
proj_list_destroy(pj_list)
|
| 246 |
+
return NULL
|
| 247 |
+
cdef PJ* datum_pj = proj_list_get(context, pj_list, 0)
|
| 248 |
+
proj_list_destroy(pj_list)
|
| 249 |
+
return datum_pj
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def _load_proj_json(str in_proj_json):
|
| 253 |
+
try:
|
| 254 |
+
return json.loads(in_proj_json)
|
| 255 |
+
except ValueError:
|
| 256 |
+
raise CRSError("Invalid JSON")
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
cdef class Axis:
|
| 260 |
+
"""
|
| 261 |
+
.. versionadded:: 2.0.0
|
| 262 |
+
|
| 263 |
+
Coordinate System Axis
|
| 264 |
+
|
| 265 |
+
Attributes
|
| 266 |
+
----------
|
| 267 |
+
name: str
|
| 268 |
+
abbrev: str
|
| 269 |
+
direction: str
|
| 270 |
+
unit_conversion_factor: float
|
| 271 |
+
unit_name: str
|
| 272 |
+
unit_auth_code: str
|
| 273 |
+
unit_code: str
|
| 274 |
+
|
| 275 |
+
"""
|
| 276 |
+
def __cinit__(self):
|
| 277 |
+
self.name = "undefined"
|
| 278 |
+
self.abbrev = "undefined"
|
| 279 |
+
self.direction = "undefined"
|
| 280 |
+
self.unit_conversion_factor = float("NaN")
|
| 281 |
+
self.unit_name = "undefined"
|
| 282 |
+
self.unit_auth_code = "undefined"
|
| 283 |
+
self.unit_code = "undefined"
|
| 284 |
+
|
| 285 |
+
def __str__(self):
|
| 286 |
+
return f"{self.abbrev}[{self.direction}]: {self.name} ({self.unit_name})"
|
| 287 |
+
|
| 288 |
+
def __repr__(self):
|
| 289 |
+
return (
|
| 290 |
+
f"Axis(name={self.name}, abbrev={self.abbrev}, "
|
| 291 |
+
f"direction={self.direction}, unit_auth_code={self.unit_auth_code}, "
|
| 292 |
+
f"unit_code={self.unit_code}, unit_name={self.unit_name})"
|
| 293 |
+
)
|
| 294 |
+
|
| 295 |
+
@staticmethod
|
| 296 |
+
cdef Axis create(PJ_CONTEXT* context, PJ* projobj, int index):
|
| 297 |
+
cdef:
|
| 298 |
+
Axis axis_info = Axis()
|
| 299 |
+
const char * name = NULL
|
| 300 |
+
const char * abbrev = NULL
|
| 301 |
+
const char * direction = NULL
|
| 302 |
+
const char * unit_name = NULL
|
| 303 |
+
const char * unit_auth_code = NULL
|
| 304 |
+
const char * unit_code = NULL
|
| 305 |
+
|
| 306 |
+
if not proj_cs_get_axis_info(
|
| 307 |
+
context,
|
| 308 |
+
projobj,
|
| 309 |
+
index,
|
| 310 |
+
&name,
|
| 311 |
+
&abbrev,
|
| 312 |
+
&direction,
|
| 313 |
+
&axis_info.unit_conversion_factor,
|
| 314 |
+
&unit_name,
|
| 315 |
+
&unit_auth_code,
|
| 316 |
+
&unit_code):
|
| 317 |
+
return None
|
| 318 |
+
axis_info.name = decode_or_undefined(name)
|
| 319 |
+
axis_info.abbrev = decode_or_undefined(abbrev)
|
| 320 |
+
axis_info.direction = decode_or_undefined(direction)
|
| 321 |
+
axis_info.unit_name = decode_or_undefined(unit_name)
|
| 322 |
+
axis_info.unit_auth_code = decode_or_undefined(unit_auth_code)
|
| 323 |
+
axis_info.unit_code = decode_or_undefined(unit_code)
|
| 324 |
+
return axis_info
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
cdef create_area_of_use(PJ_CONTEXT* context, PJ* projobj):
|
| 328 |
+
cdef:
|
| 329 |
+
double west = float("nan")
|
| 330 |
+
double south = float("nan")
|
| 331 |
+
double east = float("nan")
|
| 332 |
+
double north = float("nan")
|
| 333 |
+
const char * area_name = NULL
|
| 334 |
+
|
| 335 |
+
if not proj_get_area_of_use(
|
| 336 |
+
context,
|
| 337 |
+
projobj,
|
| 338 |
+
&west,
|
| 339 |
+
&south,
|
| 340 |
+
&east,
|
| 341 |
+
&north,
|
| 342 |
+
&area_name):
|
| 343 |
+
return None
|
| 344 |
+
return AreaOfUse(
|
| 345 |
+
west=west,
|
| 346 |
+
south=south,
|
| 347 |
+
east=east,
|
| 348 |
+
north=north,
|
| 349 |
+
name=decode_or_undefined(area_name),
|
| 350 |
+
)
|
| 351 |
+
|
| 352 |
+
|
| 353 |
+
cdef class Base:
|
| 354 |
+
def __cinit__(self):
|
| 355 |
+
self.projobj = NULL
|
| 356 |
+
self.context = NULL
|
| 357 |
+
self.name = "undefined"
|
| 358 |
+
self._scope = None
|
| 359 |
+
self._remarks = None
|
| 360 |
+
|
| 361 |
+
def __dealloc__(self):
|
| 362 |
+
"""destroy projection definition"""
|
| 363 |
+
if self.projobj != NULL:
|
| 364 |
+
proj_destroy(self.projobj)
|
| 365 |
+
|
| 366 |
+
cdef _set_base_info(self):
|
| 367 |
+
"""
|
| 368 |
+
Set the name of the PJ
|
| 369 |
+
"""
|
| 370 |
+
# get proj information
|
| 371 |
+
cdef const char* proj_name = proj_get_name(self.projobj)
|
| 372 |
+
self.name = decode_or_undefined(proj_name)
|
| 373 |
+
cdef const char* scope = proj_get_scope(self.projobj)
|
| 374 |
+
if scope != NULL and scope != "":
|
| 375 |
+
self._scope = scope
|
| 376 |
+
cdef const char* remarks = proj_get_remarks(self.projobj)
|
| 377 |
+
if remarks != NULL and remarks != "":
|
| 378 |
+
self._remarks = remarks
|
| 379 |
+
|
| 380 |
+
@property
|
| 381 |
+
def remarks(self):
|
| 382 |
+
"""
|
| 383 |
+
.. versionadded:: 2.4.0
|
| 384 |
+
|
| 385 |
+
Returns
|
| 386 |
+
-------
|
| 387 |
+
str:
|
| 388 |
+
Remarks about object.
|
| 389 |
+
"""
|
| 390 |
+
return self._remarks
|
| 391 |
+
|
| 392 |
+
@property
|
| 393 |
+
def scope(self):
|
| 394 |
+
"""
|
| 395 |
+
.. versionadded:: 2.4.0
|
| 396 |
+
|
| 397 |
+
Returns
|
| 398 |
+
-------
|
| 399 |
+
str:
|
| 400 |
+
Scope of object.
|
| 401 |
+
"""
|
| 402 |
+
return self._scope
|
| 403 |
+
|
| 404 |
+
def to_wkt(self, version=WktVersion.WKT2_2019, pretty=False, output_axis_rule=None):
|
| 405 |
+
"""
|
| 406 |
+
Convert the projection to a WKT string.
|
| 407 |
+
|
| 408 |
+
Version options:
|
| 409 |
+
- WKT2_2015
|
| 410 |
+
- WKT2_2015_SIMPLIFIED
|
| 411 |
+
- WKT2_2019
|
| 412 |
+
- WKT2_2019_SIMPLIFIED
|
| 413 |
+
- WKT1_GDAL
|
| 414 |
+
- WKT1_ESRI
|
| 415 |
+
|
| 416 |
+
.. versionadded:: 3.6.0 output_axis_rule
|
| 417 |
+
|
| 418 |
+
Parameters
|
| 419 |
+
----------
|
| 420 |
+
version: pyproj.enums.WktVersion, default=pyproj.enums.WktVersion.WKT2_2019
|
| 421 |
+
The version of the WKT output.
|
| 422 |
+
pretty: bool, default=False
|
| 423 |
+
If True, it will set the output to be a multiline string.
|
| 424 |
+
output_axis_rule: bool, optional, default=None
|
| 425 |
+
If True, it will set the axis rule on any case. If false, never.
|
| 426 |
+
None for AUTO, that depends on the CRS and version.
|
| 427 |
+
|
| 428 |
+
Returns
|
| 429 |
+
-------
|
| 430 |
+
str
|
| 431 |
+
"""
|
| 432 |
+
return _to_wkt(self.context, self.projobj, version, pretty=pretty, output_axis_rule=output_axis_rule)
|
| 433 |
+
|
| 434 |
+
def to_json(self, bint pretty=False, int indentation=2):
|
| 435 |
+
"""
|
| 436 |
+
.. versionadded:: 2.4.0
|
| 437 |
+
|
| 438 |
+
Convert the object to a JSON string.
|
| 439 |
+
|
| 440 |
+
Parameters
|
| 441 |
+
----------
|
| 442 |
+
pretty: bool, default=False
|
| 443 |
+
If True, it will set the output to be a multiline string.
|
| 444 |
+
indentation: int, default=2
|
| 445 |
+
If pretty is True, it will set the width of the indentation.
|
| 446 |
+
|
| 447 |
+
Returns
|
| 448 |
+
-------
|
| 449 |
+
str
|
| 450 |
+
"""
|
| 451 |
+
cdef const char* options[3]
|
| 452 |
+
multiline = b"MULTILINE=NO"
|
| 453 |
+
if pretty:
|
| 454 |
+
multiline = b"MULTILINE=YES"
|
| 455 |
+
indentation_width = cstrencode(f"INDENTATION_WIDTH={indentation:.0f}")
|
| 456 |
+
options[0] = multiline
|
| 457 |
+
options[1] = indentation_width
|
| 458 |
+
options[2] = NULL
|
| 459 |
+
|
| 460 |
+
cdef const char* proj_json_string = proj_as_projjson(
|
| 461 |
+
self.context,
|
| 462 |
+
self.projobj,
|
| 463 |
+
options,
|
| 464 |
+
)
|
| 465 |
+
return cstrdecode(proj_json_string)
|
| 466 |
+
|
| 467 |
+
def to_json_dict(self):
|
| 468 |
+
"""
|
| 469 |
+
.. versionadded:: 2.4.0
|
| 470 |
+
|
| 471 |
+
Convert the object to a JSON dictionary.
|
| 472 |
+
|
| 473 |
+
Returns
|
| 474 |
+
-------
|
| 475 |
+
dict
|
| 476 |
+
"""
|
| 477 |
+
return json.loads(self.to_json())
|
| 478 |
+
|
| 479 |
+
def __str__(self):
|
| 480 |
+
return self.name
|
| 481 |
+
|
| 482 |
+
def __repr__(self):
|
| 483 |
+
return self.to_wkt(pretty=True)
|
| 484 |
+
|
| 485 |
+
def _is_exact_same(self, Base other):
|
| 486 |
+
return proj_is_equivalent_to_with_ctx(
|
| 487 |
+
self.context, self.projobj, other.projobj, PJ_COMP_STRICT) == 1
|
| 488 |
+
|
| 489 |
+
def _is_equivalent(self, Base other):
|
| 490 |
+
return proj_is_equivalent_to_with_ctx(
|
| 491 |
+
self.context, self.projobj, other.projobj, PJ_COMP_EQUIVALENT) == 1
|
| 492 |
+
|
| 493 |
+
def __eq__(self, other):
|
| 494 |
+
if not isinstance(other, Base):
|
| 495 |
+
return False
|
| 496 |
+
return self._is_equivalent(other)
|
| 497 |
+
|
| 498 |
+
def is_exact_same(self, other):
|
| 499 |
+
"""Compares projection objects to see if they are exactly the same."""
|
| 500 |
+
if not isinstance(other, Base):
|
| 501 |
+
return False
|
| 502 |
+
return self._is_exact_same(other)
|
| 503 |
+
|
| 504 |
+
|
| 505 |
+
cdef class _CRSParts(Base):
|
| 506 |
+
@classmethod
|
| 507 |
+
def from_user_input(cls, user_input):
|
| 508 |
+
"""
|
| 509 |
+
.. versionadded:: 2.5.0
|
| 510 |
+
|
| 511 |
+
Create cls from user input:
|
| 512 |
+
- PROJ JSON string
|
| 513 |
+
- PROJ JSON dict
|
| 514 |
+
- WKT string
|
| 515 |
+
- An authority string
|
| 516 |
+
- An EPSG integer code
|
| 517 |
+
- An iterable of ("auth_name", "auth_code")
|
| 518 |
+
- An object with a `to_json` method.
|
| 519 |
+
|
| 520 |
+
Parameters
|
| 521 |
+
----------
|
| 522 |
+
user_input: str, dict, int, Iterable[str, str]
|
| 523 |
+
Input to create cls.
|
| 524 |
+
|
| 525 |
+
Returns
|
| 526 |
+
-------
|
| 527 |
+
cls
|
| 528 |
+
"""
|
| 529 |
+
if isinstance(user_input, str):
|
| 530 |
+
prepared = cls.from_string(user_input)
|
| 531 |
+
elif isinstance(user_input, dict):
|
| 532 |
+
prepared = cls.from_json_dict(user_input)
|
| 533 |
+
elif isinstance(user_input, int) and hasattr(cls, "from_epsg"):
|
| 534 |
+
prepared = cls.from_epsg(user_input)
|
| 535 |
+
elif (
|
| 536 |
+
isinstance(user_input, (list, tuple))
|
| 537 |
+
and len(user_input) == 2
|
| 538 |
+
and hasattr(cls, "from_authority")
|
| 539 |
+
):
|
| 540 |
+
prepared = cls.from_authority(*user_input)
|
| 541 |
+
elif hasattr(user_input, "to_json"):
|
| 542 |
+
prepared = cls.from_json(user_input.to_json())
|
| 543 |
+
else:
|
| 544 |
+
raise CRSError(f"Invalid {cls.__name__} input: {user_input!r}")
|
| 545 |
+
return prepared
|
| 546 |
+
|
| 547 |
+
def __eq__(self, other):
|
| 548 |
+
try:
|
| 549 |
+
other = self.from_user_input(other)
|
| 550 |
+
except CRSError:
|
| 551 |
+
return False
|
| 552 |
+
return self._is_equivalent(other)
|
| 553 |
+
|
| 554 |
+
|
| 555 |
+
cdef dict _COORD_SYSTEM_TYPE_MAP = {
|
| 556 |
+
PJ_CS_TYPE_UNKNOWN: "unknown",
|
| 557 |
+
PJ_CS_TYPE_CARTESIAN: "cartesian",
|
| 558 |
+
PJ_CS_TYPE_ELLIPSOIDAL: "ellipsoidal",
|
| 559 |
+
PJ_CS_TYPE_VERTICAL: "vertical",
|
| 560 |
+
PJ_CS_TYPE_SPHERICAL: "spherical",
|
| 561 |
+
PJ_CS_TYPE_ORDINAL: "ordinal",
|
| 562 |
+
PJ_CS_TYPE_PARAMETRIC: "parametric",
|
| 563 |
+
PJ_CS_TYPE_DATETIMETEMPORAL: "datetimetemporal",
|
| 564 |
+
PJ_CS_TYPE_TEMPORALCOUNT: "temporalcount",
|
| 565 |
+
PJ_CS_TYPE_TEMPORALMEASURE: "temporalmeasure",
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
cdef class CoordinateSystem(_CRSParts):
|
| 569 |
+
"""
|
| 570 |
+
.. versionadded:: 2.2.0
|
| 571 |
+
|
| 572 |
+
Coordinate System for CRS
|
| 573 |
+
|
| 574 |
+
Attributes
|
| 575 |
+
----------
|
| 576 |
+
name: str
|
| 577 |
+
The name of the coordinate system.
|
| 578 |
+
|
| 579 |
+
"""
|
| 580 |
+
def __cinit__(self):
|
| 581 |
+
self._axis_list = None
|
| 582 |
+
|
| 583 |
+
def __init__(self):
|
| 584 |
+
raise RuntimeError("CoordinateSystem is not initializable.")
|
| 585 |
+
|
| 586 |
+
@staticmethod
|
| 587 |
+
cdef CoordinateSystem create(PJ_CONTEXT* context, PJ* coord_system_pj):
|
| 588 |
+
cdef CoordinateSystem coord_system = CoordinateSystem.__new__(CoordinateSystem)
|
| 589 |
+
coord_system.context = context
|
| 590 |
+
coord_system._context_manager = get_context_manager()
|
| 591 |
+
coord_system.projobj = coord_system_pj
|
| 592 |
+
|
| 593 |
+
cdef PJ_COORDINATE_SYSTEM_TYPE cs_type = proj_cs_get_type(
|
| 594 |
+
coord_system.context,
|
| 595 |
+
coord_system.projobj,
|
| 596 |
+
)
|
| 597 |
+
coord_system.name = _COORD_SYSTEM_TYPE_MAP[cs_type]
|
| 598 |
+
return coord_system
|
| 599 |
+
|
| 600 |
+
@property
|
| 601 |
+
def axis_list(self):
|
| 602 |
+
"""
|
| 603 |
+
Returns
|
| 604 |
+
-------
|
| 605 |
+
list[Axis]:
|
| 606 |
+
The Axis list for the coordinate system.
|
| 607 |
+
"""
|
| 608 |
+
if self._axis_list is not None:
|
| 609 |
+
return self._axis_list
|
| 610 |
+
self._axis_list = []
|
| 611 |
+
cdef int num_axes = 0
|
| 612 |
+
num_axes = proj_cs_get_axis_count(
|
| 613 |
+
self.context,
|
| 614 |
+
self.projobj
|
| 615 |
+
)
|
| 616 |
+
for axis_idx from 0 <= axis_idx < num_axes:
|
| 617 |
+
self._axis_list.append(
|
| 618 |
+
Axis.create(
|
| 619 |
+
self.context,
|
| 620 |
+
self.projobj,
|
| 621 |
+
axis_idx
|
| 622 |
+
)
|
| 623 |
+
)
|
| 624 |
+
return self._axis_list
|
| 625 |
+
|
| 626 |
+
@staticmethod
|
| 627 |
+
def from_string(str coordinate_system_string not None):
|
| 628 |
+
"""
|
| 629 |
+
.. versionadded:: 2.5.0
|
| 630 |
+
|
| 631 |
+
.. note:: Only works with PROJ JSON.
|
| 632 |
+
|
| 633 |
+
Create a Coordinate System from a string.
|
| 634 |
+
|
| 635 |
+
Parameters
|
| 636 |
+
----------
|
| 637 |
+
coordinate_system_string: str
|
| 638 |
+
Coordinate System string.
|
| 639 |
+
|
| 640 |
+
Returns
|
| 641 |
+
-------
|
| 642 |
+
CoordinateSystem
|
| 643 |
+
"""
|
| 644 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 645 |
+
cdef PJ* coordinate_system_pj = proj_create(
|
| 646 |
+
context,
|
| 647 |
+
cstrencode(coordinate_system_string)
|
| 648 |
+
)
|
| 649 |
+
if coordinate_system_pj == NULL or proj_cs_get_type(
|
| 650 |
+
context,
|
| 651 |
+
coordinate_system_pj,
|
| 652 |
+
) == PJ_CS_TYPE_UNKNOWN:
|
| 653 |
+
proj_destroy(coordinate_system_pj)
|
| 654 |
+
raise CRSError(
|
| 655 |
+
"Invalid coordinate system string: "
|
| 656 |
+
f"{coordinate_system_string}"
|
| 657 |
+
)
|
| 658 |
+
_clear_proj_error()
|
| 659 |
+
return CoordinateSystem.create(context, coordinate_system_pj)
|
| 660 |
+
|
| 661 |
+
@staticmethod
|
| 662 |
+
def from_json_dict(dict coordinate_system_dict not None):
|
| 663 |
+
"""
|
| 664 |
+
.. versionadded:: 2.5.0
|
| 665 |
+
|
| 666 |
+
Create Coordinate System from a JSON dictionary.
|
| 667 |
+
|
| 668 |
+
Parameters
|
| 669 |
+
----------
|
| 670 |
+
coordinate_system_dict: str
|
| 671 |
+
Coordinate System dictionary.
|
| 672 |
+
|
| 673 |
+
Returns
|
| 674 |
+
-------
|
| 675 |
+
CoordinateSystem
|
| 676 |
+
"""
|
| 677 |
+
return CoordinateSystem.from_string(
|
| 678 |
+
json.dumps(coordinate_system_dict, cls=NumpyEncoder)
|
| 679 |
+
)
|
| 680 |
+
|
| 681 |
+
@staticmethod
|
| 682 |
+
def from_json(str coordinate_system_json_str not None):
|
| 683 |
+
"""
|
| 684 |
+
.. versionadded:: 2.5.0
|
| 685 |
+
|
| 686 |
+
Create Coordinate System from a JSON string.
|
| 687 |
+
|
| 688 |
+
Parameters
|
| 689 |
+
----------
|
| 690 |
+
coordinate_system_json_str: str
|
| 691 |
+
Coordinate System JSON string.
|
| 692 |
+
|
| 693 |
+
Returns
|
| 694 |
+
-------
|
| 695 |
+
CoordinateSystem
|
| 696 |
+
"""
|
| 697 |
+
return CoordinateSystem.from_json_dict(
|
| 698 |
+
_load_proj_json(coordinate_system_json_str)
|
| 699 |
+
)
|
| 700 |
+
|
| 701 |
+
def to_cf(self, bint rotated_pole=False):
|
| 702 |
+
"""
|
| 703 |
+
.. versionadded:: 3.0.0
|
| 704 |
+
|
| 705 |
+
This converts a :obj:`pyproj.crs.CoordinateSystem` axis
|
| 706 |
+
to a list of Climate and Forecast (CF) Version 1.8 dicts.
|
| 707 |
+
|
| 708 |
+
Parameters
|
| 709 |
+
----------
|
| 710 |
+
rotated_pole: bool, default=False
|
| 711 |
+
If True, the geographic coordinates are on a rotated pole grid.
|
| 712 |
+
This corresponds to the rotated_latitude_longitude grid_mapping_name.
|
| 713 |
+
|
| 714 |
+
Returns
|
| 715 |
+
-------
|
| 716 |
+
list[dict]:
|
| 717 |
+
CF-1.8 version of the CoordinateSystem.
|
| 718 |
+
"""
|
| 719 |
+
axis_list = self.to_json_dict()["axis"]
|
| 720 |
+
cf_params = []
|
| 721 |
+
def get_linear_unit(axis):
|
| 722 |
+
try:
|
| 723 |
+
return f'{axis["unit"]["conversion_factor"]} metre'
|
| 724 |
+
except TypeError:
|
| 725 |
+
return axis["unit"]
|
| 726 |
+
|
| 727 |
+
if self.name == "cartesian":
|
| 728 |
+
for axis in axis_list:
|
| 729 |
+
if axis["name"].lower() == "easting":
|
| 730 |
+
cf_axis = "X"
|
| 731 |
+
else:
|
| 732 |
+
cf_axis = "Y"
|
| 733 |
+
cf_params.append(dict(
|
| 734 |
+
axis=cf_axis,
|
| 735 |
+
long_name=axis["name"],
|
| 736 |
+
standard_name=f"projection_{cf_axis.lower()}_coordinate",
|
| 737 |
+
units=get_linear_unit(axis),
|
| 738 |
+
))
|
| 739 |
+
elif self.name == "ellipsoidal":
|
| 740 |
+
for axis in axis_list:
|
| 741 |
+
if axis["abbreviation"].upper() in ("D", "H"):
|
| 742 |
+
cf_params.append(dict(
|
| 743 |
+
standard_name="height_above_reference_ellipsoid",
|
| 744 |
+
long_name=axis["name"],
|
| 745 |
+
units=axis["unit"],
|
| 746 |
+
positive=axis["direction"],
|
| 747 |
+
axis="Z",
|
| 748 |
+
))
|
| 749 |
+
else:
|
| 750 |
+
if "longitude" in axis["name"].lower():
|
| 751 |
+
cf_axis = "X"
|
| 752 |
+
name = "longitude"
|
| 753 |
+
else:
|
| 754 |
+
cf_axis = "Y"
|
| 755 |
+
name = "latitude"
|
| 756 |
+
if rotated_pole:
|
| 757 |
+
cf_params.append(dict(
|
| 758 |
+
standard_name=f"grid_{name}",
|
| 759 |
+
long_name=f"{name} in rotated pole grid",
|
| 760 |
+
units="degrees",
|
| 761 |
+
axis=cf_axis,
|
| 762 |
+
))
|
| 763 |
+
else:
|
| 764 |
+
cf_params.append(dict(
|
| 765 |
+
standard_name=name,
|
| 766 |
+
long_name=f"{name} coordinate",
|
| 767 |
+
units=f'degrees_{axis["direction"]}',
|
| 768 |
+
axis=cf_axis,
|
| 769 |
+
))
|
| 770 |
+
elif self.name == "vertical":
|
| 771 |
+
for axis in axis_list:
|
| 772 |
+
cf_params.append(dict(
|
| 773 |
+
standard_name="height_above_reference_ellipsoid",
|
| 774 |
+
long_name=axis["name"],
|
| 775 |
+
units=get_linear_unit(axis),
|
| 776 |
+
positive=axis["direction"],
|
| 777 |
+
axis="Z",
|
| 778 |
+
))
|
| 779 |
+
|
| 780 |
+
return cf_params
|
| 781 |
+
|
| 782 |
+
|
| 783 |
+
cdef class Ellipsoid(_CRSParts):
|
| 784 |
+
"""
|
| 785 |
+
.. versionadded:: 2.0.0
|
| 786 |
+
|
| 787 |
+
Ellipsoid for CRS
|
| 788 |
+
|
| 789 |
+
Attributes
|
| 790 |
+
----------
|
| 791 |
+
name: str
|
| 792 |
+
The name of the ellipsoid.
|
| 793 |
+
is_semi_minor_computed: int
|
| 794 |
+
1 if True, 0 if False
|
| 795 |
+
semi_major_metre: float
|
| 796 |
+
The semi major axis in meters of the ellipsoid.
|
| 797 |
+
semi_minor_metre: float
|
| 798 |
+
The semi minor axis in meters of the ellipsoid.
|
| 799 |
+
inverse_flattening: float
|
| 800 |
+
The inverse flattening of the ellipsoid.
|
| 801 |
+
|
| 802 |
+
"""
|
| 803 |
+
def __cinit__(self):
|
| 804 |
+
# load in ellipsoid information if applicable
|
| 805 |
+
self.semi_major_metre = float("NaN")
|
| 806 |
+
self.semi_minor_metre = float("NaN")
|
| 807 |
+
self.is_semi_minor_computed = False
|
| 808 |
+
self.inverse_flattening = float("NaN")
|
| 809 |
+
|
| 810 |
+
def __init__(self):
|
| 811 |
+
raise RuntimeError(
|
| 812 |
+
"Ellipsoid can only be initialized like 'Ellipsoid.from_*()'."
|
| 813 |
+
)
|
| 814 |
+
|
| 815 |
+
@staticmethod
|
| 816 |
+
cdef Ellipsoid create(PJ_CONTEXT* context, PJ* ellipsoid_pj):
|
| 817 |
+
cdef Ellipsoid ellips = Ellipsoid.__new__(Ellipsoid)
|
| 818 |
+
ellips.context = context
|
| 819 |
+
ellips._context_manager = get_context_manager()
|
| 820 |
+
ellips.projobj = ellipsoid_pj
|
| 821 |
+
cdef int is_semi_minor_computed = 0
|
| 822 |
+
proj_ellipsoid_get_parameters(
|
| 823 |
+
context,
|
| 824 |
+
ellipsoid_pj,
|
| 825 |
+
&ellips.semi_major_metre,
|
| 826 |
+
&ellips.semi_minor_metre,
|
| 827 |
+
&is_semi_minor_computed,
|
| 828 |
+
&ellips.inverse_flattening,
|
| 829 |
+
)
|
| 830 |
+
ellips.is_semi_minor_computed = is_semi_minor_computed == 1
|
| 831 |
+
ellips._set_base_info()
|
| 832 |
+
_clear_proj_error()
|
| 833 |
+
return ellips
|
| 834 |
+
|
| 835 |
+
@staticmethod
|
| 836 |
+
def from_authority(str auth_name not None, code not None):
|
| 837 |
+
"""
|
| 838 |
+
.. versionadded:: 2.2.0
|
| 839 |
+
|
| 840 |
+
Create an Ellipsoid from an authority code.
|
| 841 |
+
|
| 842 |
+
Parameters
|
| 843 |
+
----------
|
| 844 |
+
auth_name: str
|
| 845 |
+
Name of the authority.
|
| 846 |
+
code: str or int
|
| 847 |
+
The code used by the authority.
|
| 848 |
+
|
| 849 |
+
Returns
|
| 850 |
+
-------
|
| 851 |
+
Ellipsoid
|
| 852 |
+
"""
|
| 853 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 854 |
+
cdef PJ* ellipsoid_pj = proj_create_from_database(
|
| 855 |
+
context,
|
| 856 |
+
cstrencode(auth_name),
|
| 857 |
+
cstrencode(str(code)),
|
| 858 |
+
PJ_CATEGORY_ELLIPSOID,
|
| 859 |
+
False,
|
| 860 |
+
NULL,
|
| 861 |
+
)
|
| 862 |
+
|
| 863 |
+
if ellipsoid_pj == NULL:
|
| 864 |
+
raise CRSError(f"Invalid authority or code ({auth_name}, {code})")
|
| 865 |
+
_clear_proj_error()
|
| 866 |
+
return Ellipsoid.create(context, ellipsoid_pj)
|
| 867 |
+
|
| 868 |
+
@staticmethod
|
| 869 |
+
def from_epsg(code not None):
|
| 870 |
+
"""
|
| 871 |
+
.. versionadded:: 2.2.0
|
| 872 |
+
|
| 873 |
+
Create an Ellipsoid from an EPSG code.
|
| 874 |
+
|
| 875 |
+
Parameters
|
| 876 |
+
----------
|
| 877 |
+
code: str or int
|
| 878 |
+
The code used by the EPSG.
|
| 879 |
+
|
| 880 |
+
Returns
|
| 881 |
+
-------
|
| 882 |
+
Ellipsoid
|
| 883 |
+
"""
|
| 884 |
+
return Ellipsoid.from_authority("EPSG", code)
|
| 885 |
+
|
| 886 |
+
@staticmethod
|
| 887 |
+
def _from_string(str ellipsoid_string not None):
|
| 888 |
+
"""
|
| 889 |
+
Create an Ellipsoid from a string.
|
| 890 |
+
|
| 891 |
+
Examples:
|
| 892 |
+
- urn:ogc:def:ellipsoid:EPSG::7001
|
| 893 |
+
- ELLIPSOID["Airy 1830",6377563.396,299.3249646,
|
| 894 |
+
LENGTHUNIT["metre",1],
|
| 895 |
+
ID["EPSG",7001]]
|
| 896 |
+
|
| 897 |
+
Parameters
|
| 898 |
+
----------
|
| 899 |
+
ellipsoid_string: str
|
| 900 |
+
Ellipsoid string.
|
| 901 |
+
|
| 902 |
+
Returns
|
| 903 |
+
-------
|
| 904 |
+
Ellipsoid
|
| 905 |
+
"""
|
| 906 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 907 |
+
cdef PJ* ellipsoid_pj = proj_create(
|
| 908 |
+
context,
|
| 909 |
+
cstrencode(ellipsoid_string)
|
| 910 |
+
)
|
| 911 |
+
if ellipsoid_pj == NULL or proj_get_type(ellipsoid_pj) != PJ_TYPE_ELLIPSOID:
|
| 912 |
+
proj_destroy(ellipsoid_pj)
|
| 913 |
+
raise CRSError(
|
| 914 |
+
f"Invalid ellipsoid string: {ellipsoid_string}"
|
| 915 |
+
)
|
| 916 |
+
_clear_proj_error()
|
| 917 |
+
return Ellipsoid.create(context, ellipsoid_pj)
|
| 918 |
+
|
| 919 |
+
@staticmethod
|
| 920 |
+
def from_string(str ellipsoid_string not None):
|
| 921 |
+
"""
|
| 922 |
+
.. versionadded:: 2.2.0
|
| 923 |
+
|
| 924 |
+
Create an Ellipsoid from a string.
|
| 925 |
+
|
| 926 |
+
Examples:
|
| 927 |
+
- urn:ogc:def:ellipsoid:EPSG::7001
|
| 928 |
+
- ELLIPSOID["Airy 1830",6377563.396,299.3249646,
|
| 929 |
+
LENGTHUNIT["metre",1],
|
| 930 |
+
ID["EPSG",7001]]
|
| 931 |
+
- WGS 84
|
| 932 |
+
|
| 933 |
+
Parameters
|
| 934 |
+
----------
|
| 935 |
+
ellipsoid_string: str
|
| 936 |
+
Ellipsoid string.
|
| 937 |
+
|
| 938 |
+
Returns
|
| 939 |
+
-------
|
| 940 |
+
Ellipsoid
|
| 941 |
+
"""
|
| 942 |
+
try:
|
| 943 |
+
return Ellipsoid._from_string(ellipsoid_string)
|
| 944 |
+
except CRSError as crs_err:
|
| 945 |
+
try:
|
| 946 |
+
return Ellipsoid.from_name(ellipsoid_string)
|
| 947 |
+
except CRSError:
|
| 948 |
+
raise crs_err
|
| 949 |
+
|
| 950 |
+
@staticmethod
|
| 951 |
+
def from_json_dict(dict ellipsoid_dict not None):
|
| 952 |
+
"""
|
| 953 |
+
.. versionadded:: 2.4.0
|
| 954 |
+
|
| 955 |
+
Create Ellipsoid from a JSON dictionary.
|
| 956 |
+
|
| 957 |
+
Parameters
|
| 958 |
+
----------
|
| 959 |
+
ellipsoid_dict: str
|
| 960 |
+
Ellipsoid dictionary.
|
| 961 |
+
|
| 962 |
+
Returns
|
| 963 |
+
-------
|
| 964 |
+
Ellipsoid
|
| 965 |
+
"""
|
| 966 |
+
return Ellipsoid._from_string(json.dumps(ellipsoid_dict, cls=NumpyEncoder))
|
| 967 |
+
|
| 968 |
+
@staticmethod
|
| 969 |
+
def from_json(str ellipsoid_json_str not None):
|
| 970 |
+
"""
|
| 971 |
+
.. versionadded:: 2.4.0
|
| 972 |
+
|
| 973 |
+
Create Ellipsoid from a JSON string.
|
| 974 |
+
|
| 975 |
+
Parameters
|
| 976 |
+
----------
|
| 977 |
+
ellipsoid_json_str: str
|
| 978 |
+
Ellipsoid JSON string.
|
| 979 |
+
|
| 980 |
+
Returns
|
| 981 |
+
-------
|
| 982 |
+
Ellipsoid
|
| 983 |
+
"""
|
| 984 |
+
return Ellipsoid.from_json_dict(_load_proj_json(ellipsoid_json_str))
|
| 985 |
+
|
| 986 |
+
@staticmethod
|
| 987 |
+
def _from_name(
|
| 988 |
+
str ellipsoid_name,
|
| 989 |
+
str auth_name,
|
| 990 |
+
):
|
| 991 |
+
"""
|
| 992 |
+
.. versionadded:: 2.5.0
|
| 993 |
+
|
| 994 |
+
Create a Ellipsoid from a name.
|
| 995 |
+
|
| 996 |
+
Parameters
|
| 997 |
+
----------
|
| 998 |
+
ellipsoid_name: str
|
| 999 |
+
Ellipsoid name.
|
| 1000 |
+
auth_name: str
|
| 1001 |
+
The authority name to refine search (e.g. 'EPSG').
|
| 1002 |
+
If None, will search all authorities.
|
| 1003 |
+
|
| 1004 |
+
Returns
|
| 1005 |
+
-------
|
| 1006 |
+
Ellipsoid
|
| 1007 |
+
"""
|
| 1008 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1009 |
+
cdef PJ* ellipsoid_pj = _from_name(
|
| 1010 |
+
context,
|
| 1011 |
+
ellipsoid_name,
|
| 1012 |
+
auth_name,
|
| 1013 |
+
PJ_TYPE_ELLIPSOID,
|
| 1014 |
+
)
|
| 1015 |
+
if ellipsoid_pj == NULL:
|
| 1016 |
+
raise CRSError(f"Invalid ellipsoid name: {ellipsoid_name}")
|
| 1017 |
+
_clear_proj_error()
|
| 1018 |
+
return Ellipsoid.create(context, ellipsoid_pj)
|
| 1019 |
+
|
| 1020 |
+
@staticmethod
|
| 1021 |
+
def from_name(
|
| 1022 |
+
str ellipsoid_name not None,
|
| 1023 |
+
str auth_name=None,
|
| 1024 |
+
):
|
| 1025 |
+
"""
|
| 1026 |
+
.. versionadded:: 2.5.0
|
| 1027 |
+
|
| 1028 |
+
Create a Ellipsoid from a name.
|
| 1029 |
+
|
| 1030 |
+
Examples:
|
| 1031 |
+
- WGS 84
|
| 1032 |
+
|
| 1033 |
+
Parameters
|
| 1034 |
+
----------
|
| 1035 |
+
ellipsoid_name: str
|
| 1036 |
+
Ellipsoid name.
|
| 1037 |
+
auth_name: str, optional
|
| 1038 |
+
The authority name to refine search (e.g. 'EPSG').
|
| 1039 |
+
If None, will search all authorities.
|
| 1040 |
+
|
| 1041 |
+
Returns
|
| 1042 |
+
-------
|
| 1043 |
+
Ellipsoid
|
| 1044 |
+
"""
|
| 1045 |
+
try:
|
| 1046 |
+
return Ellipsoid._from_name(
|
| 1047 |
+
ellipsoid_name=ellipsoid_name,
|
| 1048 |
+
auth_name=auth_name,
|
| 1049 |
+
)
|
| 1050 |
+
except CRSError:
|
| 1051 |
+
if auth_name not in ("PROJ", None):
|
| 1052 |
+
raise
|
| 1053 |
+
pass
|
| 1054 |
+
|
| 1055 |
+
# add support for past names for PROJ ellipsoids
|
| 1056 |
+
try:
|
| 1057 |
+
ellipsoid_params = pj_ellps[
|
| 1058 |
+
_PJ_ELLPS_NAME_MAP.get(ellipsoid_name, ellipsoid_name)
|
| 1059 |
+
]
|
| 1060 |
+
except KeyError:
|
| 1061 |
+
raise CRSError(f"Invalid ellipsoid name: {ellipsoid_name}")
|
| 1062 |
+
return CustomEllipsoid(
|
| 1063 |
+
name=ellipsoid_params["description"],
|
| 1064 |
+
semi_major_axis=ellipsoid_params["a"],
|
| 1065 |
+
semi_minor_axis=ellipsoid_params.get("b"),
|
| 1066 |
+
inverse_flattening=ellipsoid_params.get("rf"),
|
| 1067 |
+
)
|
| 1068 |
+
|
| 1069 |
+
|
| 1070 |
+
cdef class PrimeMeridian(_CRSParts):
|
| 1071 |
+
"""
|
| 1072 |
+
.. versionadded:: 2.0.0
|
| 1073 |
+
|
| 1074 |
+
Prime Meridian for CRS
|
| 1075 |
+
|
| 1076 |
+
Attributes
|
| 1077 |
+
----------
|
| 1078 |
+
name: str
|
| 1079 |
+
The name of the prime meridian.
|
| 1080 |
+
unit_name: str
|
| 1081 |
+
The unit name for the prime meridian.
|
| 1082 |
+
|
| 1083 |
+
"""
|
| 1084 |
+
def __cinit__(self):
|
| 1085 |
+
self.unit_name = None
|
| 1086 |
+
|
| 1087 |
+
def __init__(self):
|
| 1088 |
+
raise RuntimeError(
|
| 1089 |
+
"PrimeMeridian can only be initialized like 'PrimeMeridian.from_*()'."
|
| 1090 |
+
)
|
| 1091 |
+
|
| 1092 |
+
@staticmethod
|
| 1093 |
+
cdef PrimeMeridian create(PJ_CONTEXT* context, PJ* prime_meridian_pj):
|
| 1094 |
+
cdef PrimeMeridian prime_meridian = PrimeMeridian.__new__(PrimeMeridian)
|
| 1095 |
+
prime_meridian.context = context
|
| 1096 |
+
prime_meridian._context_manager = get_context_manager()
|
| 1097 |
+
prime_meridian.projobj = prime_meridian_pj
|
| 1098 |
+
cdef const char * unit_name
|
| 1099 |
+
proj_prime_meridian_get_parameters(
|
| 1100 |
+
prime_meridian.context,
|
| 1101 |
+
prime_meridian.projobj,
|
| 1102 |
+
&prime_meridian.longitude,
|
| 1103 |
+
&prime_meridian.unit_conversion_factor,
|
| 1104 |
+
&unit_name,
|
| 1105 |
+
)
|
| 1106 |
+
prime_meridian.unit_name = decode_or_undefined(unit_name)
|
| 1107 |
+
prime_meridian._set_base_info()
|
| 1108 |
+
_clear_proj_error()
|
| 1109 |
+
return prime_meridian
|
| 1110 |
+
|
| 1111 |
+
@staticmethod
|
| 1112 |
+
def from_authority(str auth_name not None, code not None):
|
| 1113 |
+
"""
|
| 1114 |
+
.. versionadded:: 2.2.0
|
| 1115 |
+
|
| 1116 |
+
Create a PrimeMeridian from an authority code.
|
| 1117 |
+
|
| 1118 |
+
Parameters
|
| 1119 |
+
----------
|
| 1120 |
+
auth_name: str
|
| 1121 |
+
Name of the authority.
|
| 1122 |
+
code: str or int
|
| 1123 |
+
The code used by the authority.
|
| 1124 |
+
|
| 1125 |
+
Returns
|
| 1126 |
+
-------
|
| 1127 |
+
PrimeMeridian
|
| 1128 |
+
"""
|
| 1129 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1130 |
+
cdef PJ* prime_meridian_pj = proj_create_from_database(
|
| 1131 |
+
context,
|
| 1132 |
+
cstrencode(auth_name),
|
| 1133 |
+
cstrencode(str(code)),
|
| 1134 |
+
PJ_CATEGORY_PRIME_MERIDIAN,
|
| 1135 |
+
False,
|
| 1136 |
+
NULL,
|
| 1137 |
+
)
|
| 1138 |
+
|
| 1139 |
+
if prime_meridian_pj == NULL:
|
| 1140 |
+
raise CRSError(f"Invalid authority or code ({auth_name}, {code})")
|
| 1141 |
+
_clear_proj_error()
|
| 1142 |
+
return PrimeMeridian.create(context, prime_meridian_pj)
|
| 1143 |
+
|
| 1144 |
+
@staticmethod
|
| 1145 |
+
def from_epsg(code not None):
|
| 1146 |
+
"""
|
| 1147 |
+
.. versionadded:: 2.2.0
|
| 1148 |
+
|
| 1149 |
+
Create a PrimeMeridian from an EPSG code.
|
| 1150 |
+
|
| 1151 |
+
Parameters
|
| 1152 |
+
----------
|
| 1153 |
+
code: str or int
|
| 1154 |
+
The code used by EPSG.
|
| 1155 |
+
|
| 1156 |
+
Returns
|
| 1157 |
+
-------
|
| 1158 |
+
PrimeMeridian
|
| 1159 |
+
"""
|
| 1160 |
+
return PrimeMeridian.from_authority("EPSG", code)
|
| 1161 |
+
|
| 1162 |
+
@staticmethod
|
| 1163 |
+
def _from_string(str prime_meridian_string not None):
|
| 1164 |
+
"""
|
| 1165 |
+
Create an PrimeMeridian from a string.
|
| 1166 |
+
|
| 1167 |
+
Examples:
|
| 1168 |
+
- urn:ogc:def:meridian:EPSG::8901
|
| 1169 |
+
- PRIMEM["Greenwich",0,
|
| 1170 |
+
ANGLEUNIT["degree",0.0174532925199433],
|
| 1171 |
+
ID["EPSG",8901]]
|
| 1172 |
+
|
| 1173 |
+
Parameters
|
| 1174 |
+
----------
|
| 1175 |
+
prime_meridian_string: str
|
| 1176 |
+
prime meridian string.
|
| 1177 |
+
|
| 1178 |
+
Returns
|
| 1179 |
+
-------
|
| 1180 |
+
PrimeMeridian
|
| 1181 |
+
"""
|
| 1182 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1183 |
+
cdef PJ* prime_meridian_pj = proj_create(
|
| 1184 |
+
context,
|
| 1185 |
+
cstrencode(prime_meridian_string)
|
| 1186 |
+
)
|
| 1187 |
+
if (
|
| 1188 |
+
prime_meridian_pj == NULL or
|
| 1189 |
+
proj_get_type(prime_meridian_pj) != PJ_TYPE_PRIME_MERIDIAN
|
| 1190 |
+
):
|
| 1191 |
+
proj_destroy(prime_meridian_pj)
|
| 1192 |
+
raise CRSError(
|
| 1193 |
+
f"Invalid prime meridian string: {prime_meridian_string}"
|
| 1194 |
+
)
|
| 1195 |
+
_clear_proj_error()
|
| 1196 |
+
return PrimeMeridian.create(context, prime_meridian_pj)
|
| 1197 |
+
|
| 1198 |
+
@staticmethod
|
| 1199 |
+
def from_string(str prime_meridian_string not None):
|
| 1200 |
+
"""
|
| 1201 |
+
.. versionadded:: 2.2.0
|
| 1202 |
+
|
| 1203 |
+
Create an PrimeMeridian from a string.
|
| 1204 |
+
|
| 1205 |
+
Examples:
|
| 1206 |
+
- urn:ogc:def:meridian:EPSG::8901
|
| 1207 |
+
- PRIMEM["Greenwich",0,
|
| 1208 |
+
ANGLEUNIT["degree",0.0174532925199433],
|
| 1209 |
+
ID["EPSG",8901]]
|
| 1210 |
+
- Greenwich
|
| 1211 |
+
|
| 1212 |
+
Parameters
|
| 1213 |
+
----------
|
| 1214 |
+
prime_meridian_string: str
|
| 1215 |
+
prime meridian string.
|
| 1216 |
+
|
| 1217 |
+
Returns
|
| 1218 |
+
-------
|
| 1219 |
+
PrimeMeridian
|
| 1220 |
+
"""
|
| 1221 |
+
try:
|
| 1222 |
+
return PrimeMeridian._from_string(prime_meridian_string)
|
| 1223 |
+
except CRSError as crs_err:
|
| 1224 |
+
try:
|
| 1225 |
+
return PrimeMeridian.from_name(prime_meridian_string)
|
| 1226 |
+
except CRSError:
|
| 1227 |
+
raise crs_err
|
| 1228 |
+
|
| 1229 |
+
@staticmethod
|
| 1230 |
+
def from_json_dict(dict prime_meridian_dict not None):
|
| 1231 |
+
"""
|
| 1232 |
+
.. versionadded:: 2.4.0
|
| 1233 |
+
|
| 1234 |
+
Create PrimeMeridian from a JSON dictionary.
|
| 1235 |
+
|
| 1236 |
+
Parameters
|
| 1237 |
+
----------
|
| 1238 |
+
prime_meridian_dict: str
|
| 1239 |
+
PrimeMeridian dictionary.
|
| 1240 |
+
|
| 1241 |
+
Returns
|
| 1242 |
+
-------
|
| 1243 |
+
PrimeMeridian
|
| 1244 |
+
"""
|
| 1245 |
+
return PrimeMeridian._from_string(
|
| 1246 |
+
json.dumps(prime_meridian_dict, cls=NumpyEncoder)
|
| 1247 |
+
)
|
| 1248 |
+
|
| 1249 |
+
@staticmethod
|
| 1250 |
+
def from_json(str prime_meridian_json_str not None):
|
| 1251 |
+
"""
|
| 1252 |
+
.. versionadded:: 2.4.0
|
| 1253 |
+
|
| 1254 |
+
Create PrimeMeridian from a JSON string.
|
| 1255 |
+
|
| 1256 |
+
Parameters
|
| 1257 |
+
----------
|
| 1258 |
+
prime_meridian_json_str: str
|
| 1259 |
+
PrimeMeridian JSON string.
|
| 1260 |
+
|
| 1261 |
+
Returns
|
| 1262 |
+
-------
|
| 1263 |
+
PrimeMeridian
|
| 1264 |
+
"""
|
| 1265 |
+
return PrimeMeridian.from_json_dict(_load_proj_json(prime_meridian_json_str))
|
| 1266 |
+
|
| 1267 |
+
@staticmethod
|
| 1268 |
+
def from_name(
|
| 1269 |
+
str prime_meridian_name not None,
|
| 1270 |
+
str auth_name=None,
|
| 1271 |
+
):
|
| 1272 |
+
"""
|
| 1273 |
+
.. versionadded:: 2.5.0
|
| 1274 |
+
|
| 1275 |
+
Create a Prime Meridian from a name.
|
| 1276 |
+
|
| 1277 |
+
Examples:
|
| 1278 |
+
- Greenwich
|
| 1279 |
+
|
| 1280 |
+
Parameters
|
| 1281 |
+
----------
|
| 1282 |
+
prime_meridian_name: str
|
| 1283 |
+
Prime Meridian name.
|
| 1284 |
+
auth_name: str, optional
|
| 1285 |
+
The authority name to refine search (e.g. 'EPSG').
|
| 1286 |
+
If None, will search all authorities.
|
| 1287 |
+
|
| 1288 |
+
Returns
|
| 1289 |
+
-------
|
| 1290 |
+
PrimeMeridian
|
| 1291 |
+
"""
|
| 1292 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1293 |
+
cdef PJ* prime_meridian_pj = _from_name(
|
| 1294 |
+
context,
|
| 1295 |
+
prime_meridian_name,
|
| 1296 |
+
auth_name,
|
| 1297 |
+
PJ_TYPE_PRIME_MERIDIAN,
|
| 1298 |
+
)
|
| 1299 |
+
if prime_meridian_pj == NULL:
|
| 1300 |
+
raise CRSError(
|
| 1301 |
+
f"Invalid prime meridian name: {prime_meridian_name}"
|
| 1302 |
+
)
|
| 1303 |
+
_clear_proj_error()
|
| 1304 |
+
return PrimeMeridian.create(context, prime_meridian_pj)
|
| 1305 |
+
|
| 1306 |
+
|
| 1307 |
+
cdef dict _DATUM_TYPE_MAP = {
|
| 1308 |
+
PJ_TYPE_GEODETIC_REFERENCE_FRAME: "Geodetic Reference Frame",
|
| 1309 |
+
PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME: "Dynamic Geodetic Reference Frame",
|
| 1310 |
+
PJ_TYPE_VERTICAL_REFERENCE_FRAME: "Vertical Reference Frame",
|
| 1311 |
+
PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME: "Dynamic Vertical Reference Frame",
|
| 1312 |
+
PJ_TYPE_DATUM_ENSEMBLE: "Datum Ensemble",
|
| 1313 |
+
PJ_TYPE_TEMPORAL_DATUM: "Temporal Datum",
|
| 1314 |
+
PJ_TYPE_ENGINEERING_DATUM: "Engineering Datum",
|
| 1315 |
+
PJ_TYPE_PARAMETRIC_DATUM: "Parametric Datum",
|
| 1316 |
+
}
|
| 1317 |
+
|
| 1318 |
+
cdef dict _PJ_DATUM_TYPE_MAP = {
|
| 1319 |
+
DatumType.DATUM_ENSEMBLE: PJ_TYPE_DATUM_ENSEMBLE,
|
| 1320 |
+
DatumType.GEODETIC_REFERENCE_FRAME: PJ_TYPE_GEODETIC_REFERENCE_FRAME,
|
| 1321 |
+
DatumType.DYNAMIC_GEODETIC_REFERENCE_FRAME:
|
| 1322 |
+
PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME,
|
| 1323 |
+
DatumType.VERTICAL_REFERENCE_FRAME: PJ_TYPE_VERTICAL_REFERENCE_FRAME,
|
| 1324 |
+
DatumType.DYNAMIC_VERTICAL_REFERENCE_FRAME:
|
| 1325 |
+
PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME,
|
| 1326 |
+
}
|
| 1327 |
+
|
| 1328 |
+
|
| 1329 |
+
cdef class Datum(_CRSParts):
|
| 1330 |
+
"""
|
| 1331 |
+
.. versionadded:: 2.2.0
|
| 1332 |
+
|
| 1333 |
+
Datum for CRS. If it is a compound CRS it is the horizontal datum.
|
| 1334 |
+
|
| 1335 |
+
Attributes
|
| 1336 |
+
----------
|
| 1337 |
+
name: str
|
| 1338 |
+
The name of the datum.
|
| 1339 |
+
|
| 1340 |
+
"""
|
| 1341 |
+
def __cinit__(self):
|
| 1342 |
+
self._ellipsoid = None
|
| 1343 |
+
self._prime_meridian = None
|
| 1344 |
+
|
| 1345 |
+
def __init__(self):
|
| 1346 |
+
raise RuntimeError(
|
| 1347 |
+
"Datum can only be initialized like 'Datum.from_*()'."
|
| 1348 |
+
)
|
| 1349 |
+
|
| 1350 |
+
@staticmethod
|
| 1351 |
+
cdef Datum create(PJ_CONTEXT* context, PJ* datum_pj):
|
| 1352 |
+
cdef Datum datum = Datum.__new__(Datum)
|
| 1353 |
+
datum.context = context
|
| 1354 |
+
datum._context_manager = get_context_manager()
|
| 1355 |
+
datum.projobj = datum_pj
|
| 1356 |
+
datum._set_base_info()
|
| 1357 |
+
datum.type_name = _DATUM_TYPE_MAP[proj_get_type(datum.projobj)]
|
| 1358 |
+
return datum
|
| 1359 |
+
|
| 1360 |
+
@staticmethod
|
| 1361 |
+
def _from_authority(str auth_name not None, code not None, PJ_CATEGORY category):
|
| 1362 |
+
"""
|
| 1363 |
+
Create a Datum from an authority code.
|
| 1364 |
+
|
| 1365 |
+
Parameters
|
| 1366 |
+
----------
|
| 1367 |
+
auth_name: str
|
| 1368 |
+
Name of the authority.
|
| 1369 |
+
code: str or int
|
| 1370 |
+
The code used by the authority.
|
| 1371 |
+
|
| 1372 |
+
Returns
|
| 1373 |
+
-------
|
| 1374 |
+
Datum
|
| 1375 |
+
"""
|
| 1376 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1377 |
+
|
| 1378 |
+
cdef PJ* datum_pj = proj_create_from_database(
|
| 1379 |
+
context,
|
| 1380 |
+
cstrencode(auth_name),
|
| 1381 |
+
cstrencode(str(code)),
|
| 1382 |
+
category,
|
| 1383 |
+
False,
|
| 1384 |
+
NULL,
|
| 1385 |
+
)
|
| 1386 |
+
|
| 1387 |
+
if datum_pj == NULL:
|
| 1388 |
+
raise CRSError(f"Invalid authority or code ({auth_name}, {code})")
|
| 1389 |
+
_clear_proj_error()
|
| 1390 |
+
return Datum.create(context, datum_pj)
|
| 1391 |
+
|
| 1392 |
+
@staticmethod
|
| 1393 |
+
def from_authority(str auth_name not None, code not None):
|
| 1394 |
+
"""
|
| 1395 |
+
Create a Datum from an authority code.
|
| 1396 |
+
|
| 1397 |
+
Parameters
|
| 1398 |
+
----------
|
| 1399 |
+
auth_name: str
|
| 1400 |
+
Name of the authority.
|
| 1401 |
+
code: str or int
|
| 1402 |
+
The code used by the authority.
|
| 1403 |
+
|
| 1404 |
+
Returns
|
| 1405 |
+
-------
|
| 1406 |
+
Datum
|
| 1407 |
+
"""
|
| 1408 |
+
try:
|
| 1409 |
+
return Datum._from_authority(auth_name, code, PJ_CATEGORY_DATUM_ENSEMBLE)
|
| 1410 |
+
except CRSError:
|
| 1411 |
+
return Datum._from_authority(auth_name, code, PJ_CATEGORY_DATUM)
|
| 1412 |
+
|
| 1413 |
+
@staticmethod
|
| 1414 |
+
def from_epsg(code not None):
|
| 1415 |
+
"""
|
| 1416 |
+
Create a Datum from an EPSG code.
|
| 1417 |
+
|
| 1418 |
+
Parameters
|
| 1419 |
+
----------
|
| 1420 |
+
code: str or int
|
| 1421 |
+
The code used by EPSG.
|
| 1422 |
+
|
| 1423 |
+
Returns
|
| 1424 |
+
-------
|
| 1425 |
+
Datum
|
| 1426 |
+
"""
|
| 1427 |
+
return Datum.from_authority("EPSG", code)
|
| 1428 |
+
|
| 1429 |
+
@staticmethod
|
| 1430 |
+
def _from_string(str datum_string not None):
|
| 1431 |
+
"""
|
| 1432 |
+
Create a Datum from a string.
|
| 1433 |
+
|
| 1434 |
+
Examples:
|
| 1435 |
+
- urn:ogc:def:datum:EPSG::6326
|
| 1436 |
+
- DATUM["World Geodetic System 1984",
|
| 1437 |
+
ELLIPSOID["WGS 84",6378137,298.257223563,
|
| 1438 |
+
LENGTHUNIT["metre",1]],
|
| 1439 |
+
ID["EPSG",6326]]
|
| 1440 |
+
|
| 1441 |
+
Parameters
|
| 1442 |
+
----------
|
| 1443 |
+
datum_string: str
|
| 1444 |
+
Datum string.
|
| 1445 |
+
|
| 1446 |
+
Returns
|
| 1447 |
+
-------
|
| 1448 |
+
Datum
|
| 1449 |
+
"""
|
| 1450 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1451 |
+
cdef PJ* datum_pj = proj_create(
|
| 1452 |
+
context,
|
| 1453 |
+
cstrencode(datum_string)
|
| 1454 |
+
)
|
| 1455 |
+
if (
|
| 1456 |
+
datum_pj == NULL or
|
| 1457 |
+
proj_get_type(datum_pj) not in _DATUM_TYPE_MAP
|
| 1458 |
+
):
|
| 1459 |
+
proj_destroy(datum_pj)
|
| 1460 |
+
raise CRSError(f"Invalid datum string: {datum_string}")
|
| 1461 |
+
_clear_proj_error()
|
| 1462 |
+
return Datum.create(context, datum_pj)
|
| 1463 |
+
|
| 1464 |
+
@staticmethod
|
| 1465 |
+
def from_string(str datum_string not None):
|
| 1466 |
+
"""
|
| 1467 |
+
Create a Datum from a string.
|
| 1468 |
+
|
| 1469 |
+
Examples:
|
| 1470 |
+
- urn:ogc:def:datum:EPSG::6326
|
| 1471 |
+
- DATUM["World Geodetic System 1984",
|
| 1472 |
+
ELLIPSOID["WGS 84",6378137,298.257223563,
|
| 1473 |
+
LENGTHUNIT["metre",1]],
|
| 1474 |
+
ID["EPSG",6326]]
|
| 1475 |
+
- World Geodetic System 1984
|
| 1476 |
+
|
| 1477 |
+
Parameters
|
| 1478 |
+
----------
|
| 1479 |
+
datum_string: str
|
| 1480 |
+
Datum string.
|
| 1481 |
+
|
| 1482 |
+
Returns
|
| 1483 |
+
-------
|
| 1484 |
+
Datum
|
| 1485 |
+
"""
|
| 1486 |
+
try:
|
| 1487 |
+
return Datum._from_string(datum_string)
|
| 1488 |
+
except CRSError as crs_err:
|
| 1489 |
+
try:
|
| 1490 |
+
return Datum.from_name(datum_string)
|
| 1491 |
+
except CRSError:
|
| 1492 |
+
raise crs_err
|
| 1493 |
+
|
| 1494 |
+
@staticmethod
|
| 1495 |
+
def _from_name(
|
| 1496 |
+
str datum_name,
|
| 1497 |
+
str auth_name,
|
| 1498 |
+
object datum_type,
|
| 1499 |
+
):
|
| 1500 |
+
"""
|
| 1501 |
+
.. versionadded:: 2.5.0
|
| 1502 |
+
|
| 1503 |
+
Create a Datum from a name.
|
| 1504 |
+
|
| 1505 |
+
Parameters
|
| 1506 |
+
----------
|
| 1507 |
+
datum_name: str
|
| 1508 |
+
Datum name.
|
| 1509 |
+
auth_name: str
|
| 1510 |
+
The authority name to refine search (e.g. 'EPSG').
|
| 1511 |
+
If None, will search all authorities.
|
| 1512 |
+
datum_type: DatumType
|
| 1513 |
+
The datum type to create.
|
| 1514 |
+
|
| 1515 |
+
Returns
|
| 1516 |
+
-------
|
| 1517 |
+
Datum
|
| 1518 |
+
"""
|
| 1519 |
+
pj_datum_type = _PJ_DATUM_TYPE_MAP[datum_type]
|
| 1520 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1521 |
+
cdef PJ* datum_pj = _from_name(
|
| 1522 |
+
context,
|
| 1523 |
+
datum_name,
|
| 1524 |
+
auth_name,
|
| 1525 |
+
<PJ_TYPE>pj_datum_type,
|
| 1526 |
+
)
|
| 1527 |
+
if datum_pj == NULL:
|
| 1528 |
+
raise CRSError(f"Invalid datum name: {datum_name}")
|
| 1529 |
+
_clear_proj_error()
|
| 1530 |
+
return Datum.create(context, datum_pj)
|
| 1531 |
+
|
| 1532 |
+
@staticmethod
|
| 1533 |
+
def from_name(
|
| 1534 |
+
str datum_name not None,
|
| 1535 |
+
str auth_name=None,
|
| 1536 |
+
datum_type=None,
|
| 1537 |
+
):
|
| 1538 |
+
"""
|
| 1539 |
+
.. versionadded:: 2.5.0
|
| 1540 |
+
|
| 1541 |
+
Create a Datum from a name.
|
| 1542 |
+
|
| 1543 |
+
Examples:
|
| 1544 |
+
- WGS 84
|
| 1545 |
+
- World Geodetic System 1984
|
| 1546 |
+
|
| 1547 |
+
Parameters
|
| 1548 |
+
----------
|
| 1549 |
+
datum_name: str
|
| 1550 |
+
Datum name.
|
| 1551 |
+
auth_name: str, optional
|
| 1552 |
+
The authority name to refine search (e.g. 'EPSG').
|
| 1553 |
+
If None, will search all authorities.
|
| 1554 |
+
datum_type: DatumType, optional
|
| 1555 |
+
The datum type to create. If it is None, it uses any datum type.
|
| 1556 |
+
|
| 1557 |
+
Returns
|
| 1558 |
+
-------
|
| 1559 |
+
Datum
|
| 1560 |
+
"""
|
| 1561 |
+
if datum_type is None:
|
| 1562 |
+
# try creating name from all datum types
|
| 1563 |
+
first_error = None
|
| 1564 |
+
for datum_type in _PJ_DATUM_TYPE_MAP:
|
| 1565 |
+
try:
|
| 1566 |
+
return Datum.from_name(
|
| 1567 |
+
datum_name=datum_name,
|
| 1568 |
+
auth_name=auth_name,
|
| 1569 |
+
datum_type=datum_type,
|
| 1570 |
+
)
|
| 1571 |
+
except CRSError as err:
|
| 1572 |
+
if first_error is None:
|
| 1573 |
+
first_error = err
|
| 1574 |
+
raise first_error
|
| 1575 |
+
|
| 1576 |
+
datum_type = DatumType.create(datum_type)
|
| 1577 |
+
return Datum._from_name(
|
| 1578 |
+
datum_name=datum_name,
|
| 1579 |
+
auth_name=auth_name,
|
| 1580 |
+
datum_type=datum_type,
|
| 1581 |
+
)
|
| 1582 |
+
|
| 1583 |
+
@staticmethod
|
| 1584 |
+
def from_json_dict(dict datum_dict not None):
|
| 1585 |
+
"""
|
| 1586 |
+
.. versionadded:: 2.4.0
|
| 1587 |
+
|
| 1588 |
+
Create Datum from a JSON dictionary.
|
| 1589 |
+
|
| 1590 |
+
Parameters
|
| 1591 |
+
----------
|
| 1592 |
+
datum_dict: str
|
| 1593 |
+
Datum dictionary.
|
| 1594 |
+
|
| 1595 |
+
Returns
|
| 1596 |
+
-------
|
| 1597 |
+
Datum
|
| 1598 |
+
"""
|
| 1599 |
+
return Datum._from_string(json.dumps(datum_dict, cls=NumpyEncoder))
|
| 1600 |
+
|
| 1601 |
+
@staticmethod
|
| 1602 |
+
def from_json(str datum_json_str not None):
|
| 1603 |
+
"""
|
| 1604 |
+
.. versionadded:: 2.4.0
|
| 1605 |
+
|
| 1606 |
+
Create Datum from a JSON string.
|
| 1607 |
+
|
| 1608 |
+
Parameters
|
| 1609 |
+
----------
|
| 1610 |
+
datum_json_str: str
|
| 1611 |
+
Datum JSON string.
|
| 1612 |
+
|
| 1613 |
+
Returns
|
| 1614 |
+
-------
|
| 1615 |
+
Datum
|
| 1616 |
+
"""
|
| 1617 |
+
return Datum.from_json_dict(_load_proj_json(datum_json_str))
|
| 1618 |
+
|
| 1619 |
+
@property
|
| 1620 |
+
def ellipsoid(self):
|
| 1621 |
+
"""
|
| 1622 |
+
Returns
|
| 1623 |
+
-------
|
| 1624 |
+
Ellipsoid:
|
| 1625 |
+
The ellipsoid object with associated attributes.
|
| 1626 |
+
"""
|
| 1627 |
+
if self._ellipsoid is not None:
|
| 1628 |
+
return None if self._ellipsoid is False else self._ellipsoid
|
| 1629 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1630 |
+
cdef PJ* ellipsoid_pj = proj_get_ellipsoid(
|
| 1631 |
+
context,
|
| 1632 |
+
self.projobj,
|
| 1633 |
+
)
|
| 1634 |
+
_clear_proj_error()
|
| 1635 |
+
if ellipsoid_pj == NULL:
|
| 1636 |
+
self._ellipsoid = False
|
| 1637 |
+
return None
|
| 1638 |
+
self._ellipsoid = Ellipsoid.create(context, ellipsoid_pj)
|
| 1639 |
+
return self._ellipsoid
|
| 1640 |
+
|
| 1641 |
+
@property
|
| 1642 |
+
def prime_meridian(self):
|
| 1643 |
+
"""
|
| 1644 |
+
Returns
|
| 1645 |
+
-------
|
| 1646 |
+
PrimeMeridian:
|
| 1647 |
+
The CRS prime meridian object with associated attributes.
|
| 1648 |
+
"""
|
| 1649 |
+
if self._prime_meridian is not None:
|
| 1650 |
+
return None if self._prime_meridian is False else self._prime_meridian
|
| 1651 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1652 |
+
cdef PJ* prime_meridian_pj = proj_get_prime_meridian(
|
| 1653 |
+
context,
|
| 1654 |
+
self.projobj,
|
| 1655 |
+
)
|
| 1656 |
+
_clear_proj_error()
|
| 1657 |
+
if prime_meridian_pj == NULL:
|
| 1658 |
+
self._prime_meridian = False
|
| 1659 |
+
return None
|
| 1660 |
+
self._prime_meridian = PrimeMeridian.create(
|
| 1661 |
+
context,
|
| 1662 |
+
prime_meridian_pj,
|
| 1663 |
+
)
|
| 1664 |
+
return self._prime_meridian
|
| 1665 |
+
|
| 1666 |
+
|
| 1667 |
+
cdef class Param:
|
| 1668 |
+
"""
|
| 1669 |
+
.. versionadded:: 2.2.0
|
| 1670 |
+
|
| 1671 |
+
Coordinate operation parameter.
|
| 1672 |
+
|
| 1673 |
+
Attributes
|
| 1674 |
+
----------
|
| 1675 |
+
name: str
|
| 1676 |
+
The name of the parameter.
|
| 1677 |
+
auth_name: str
|
| 1678 |
+
The authority name of the parameter (i.e. EPSG).
|
| 1679 |
+
code: str
|
| 1680 |
+
The code of the parameter (i.e. 9807).
|
| 1681 |
+
value: str or double
|
| 1682 |
+
The value of the parameter.
|
| 1683 |
+
unit_conversion_factor: double
|
| 1684 |
+
The factor to convert to meters.
|
| 1685 |
+
unit_name: str
|
| 1686 |
+
The name of the unit.
|
| 1687 |
+
unit_auth_name: str
|
| 1688 |
+
The authority name of the unit (i.e. EPSG).
|
| 1689 |
+
unit_code: str
|
| 1690 |
+
The code of the unit (i.e. 9807).
|
| 1691 |
+
unit_category: str
|
| 1692 |
+
The category of the unit (“unknown”, “none”, “linear”,
|
| 1693 |
+
“angular”, “scale”, “time” or “parametric”).
|
| 1694 |
+
|
| 1695 |
+
"""
|
| 1696 |
+
def __cinit__(self):
|
| 1697 |
+
self.name = "undefined"
|
| 1698 |
+
self.auth_name = "undefined"
|
| 1699 |
+
self.code = "undefined"
|
| 1700 |
+
self.value = "undefined"
|
| 1701 |
+
self.unit_conversion_factor = float("nan")
|
| 1702 |
+
self.unit_name = "undefined"
|
| 1703 |
+
self.unit_auth_name = "undefined"
|
| 1704 |
+
self.unit_code = "undefined"
|
| 1705 |
+
self.unit_category = "undefined"
|
| 1706 |
+
|
| 1707 |
+
@staticmethod
|
| 1708 |
+
cdef Param create(PJ_CONTEXT* context, PJ* projobj, int param_idx):
|
| 1709 |
+
cdef:
|
| 1710 |
+
Param param = Param()
|
| 1711 |
+
const char *out_name
|
| 1712 |
+
const char *out_auth_name
|
| 1713 |
+
const char *out_code
|
| 1714 |
+
const char *out_value
|
| 1715 |
+
const char *out_value_string
|
| 1716 |
+
const char *out_unit_name
|
| 1717 |
+
const char *out_unit_auth_name
|
| 1718 |
+
const char *out_unit_code
|
| 1719 |
+
const char *out_unit_category
|
| 1720 |
+
double value_double
|
| 1721 |
+
|
| 1722 |
+
proj_coordoperation_get_param(
|
| 1723 |
+
context,
|
| 1724 |
+
projobj,
|
| 1725 |
+
param_idx,
|
| 1726 |
+
&out_name,
|
| 1727 |
+
&out_auth_name,
|
| 1728 |
+
&out_code,
|
| 1729 |
+
&value_double,
|
| 1730 |
+
&out_value_string,
|
| 1731 |
+
¶m.unit_conversion_factor,
|
| 1732 |
+
&out_unit_name,
|
| 1733 |
+
&out_unit_auth_name,
|
| 1734 |
+
&out_unit_code,
|
| 1735 |
+
&out_unit_category
|
| 1736 |
+
)
|
| 1737 |
+
param.name = decode_or_undefined(out_name)
|
| 1738 |
+
param.auth_name = decode_or_undefined(out_auth_name)
|
| 1739 |
+
param.code = decode_or_undefined(out_code)
|
| 1740 |
+
param.unit_name = decode_or_undefined(out_unit_name)
|
| 1741 |
+
param.unit_auth_name = decode_or_undefined(out_unit_auth_name)
|
| 1742 |
+
param.unit_code = decode_or_undefined(out_unit_code)
|
| 1743 |
+
param.unit_category = decode_or_undefined(out_unit_category)
|
| 1744 |
+
value_string = cstrdecode(out_value_string)
|
| 1745 |
+
param.value = value_double if value_string is None else value_string
|
| 1746 |
+
return param
|
| 1747 |
+
|
| 1748 |
+
def __str__(self):
|
| 1749 |
+
return f"{self.auth_name}:{self.auth_code}"
|
| 1750 |
+
|
| 1751 |
+
def __repr__(self):
|
| 1752 |
+
return (
|
| 1753 |
+
f"Param(name={self.name}, auth_name={self.auth_name}, code={self.code}, "
|
| 1754 |
+
f"value={self.value}, unit_name={self.unit_name}, "
|
| 1755 |
+
f"unit_auth_name={self.unit_auth_name}, unit_code={self.unit_code}, "
|
| 1756 |
+
f"unit_category={self.unit_category})"
|
| 1757 |
+
)
|
| 1758 |
+
|
| 1759 |
+
|
| 1760 |
+
cdef class Grid:
|
| 1761 |
+
"""
|
| 1762 |
+
.. versionadded:: 2.2.0
|
| 1763 |
+
|
| 1764 |
+
Coordinate operation grid.
|
| 1765 |
+
|
| 1766 |
+
Attributes
|
| 1767 |
+
----------
|
| 1768 |
+
short_name: str
|
| 1769 |
+
The short name of the grid.
|
| 1770 |
+
full_name: str
|
| 1771 |
+
The full name of the grid.
|
| 1772 |
+
package_name: str
|
| 1773 |
+
The package name where the grid might be found.
|
| 1774 |
+
url: str
|
| 1775 |
+
The grid URL or the package URL where the grid might be found.
|
| 1776 |
+
direct_download: int
|
| 1777 |
+
If 1, *url* can be downloaded directly.
|
| 1778 |
+
open_license: int
|
| 1779 |
+
If 1, the grid is released with an open license.
|
| 1780 |
+
available: int
|
| 1781 |
+
If 1, the grid is available at runtime.
|
| 1782 |
+
|
| 1783 |
+
"""
|
| 1784 |
+
def __cinit__(self):
|
| 1785 |
+
self.short_name = "undefined"
|
| 1786 |
+
self.full_name = "undefined"
|
| 1787 |
+
self.package_name = "undefined"
|
| 1788 |
+
self.url = "undefined"
|
| 1789 |
+
self.direct_download = False
|
| 1790 |
+
self.open_license = False
|
| 1791 |
+
self.available = False
|
| 1792 |
+
|
| 1793 |
+
@staticmethod
|
| 1794 |
+
cdef Grid create(PJ_CONTEXT* context, PJ* projobj, int grid_idx):
|
| 1795 |
+
cdef:
|
| 1796 |
+
Grid grid = Grid()
|
| 1797 |
+
const char *out_short_name
|
| 1798 |
+
const char *out_full_name
|
| 1799 |
+
const char *out_package_name
|
| 1800 |
+
const char *out_url
|
| 1801 |
+
int direct_download = 0
|
| 1802 |
+
int open_license = 0
|
| 1803 |
+
int available = 0
|
| 1804 |
+
|
| 1805 |
+
proj_coordoperation_get_grid_used(
|
| 1806 |
+
context,
|
| 1807 |
+
projobj,
|
| 1808 |
+
grid_idx,
|
| 1809 |
+
&out_short_name,
|
| 1810 |
+
&out_full_name,
|
| 1811 |
+
&out_package_name,
|
| 1812 |
+
&out_url,
|
| 1813 |
+
&direct_download,
|
| 1814 |
+
&open_license,
|
| 1815 |
+
&available
|
| 1816 |
+
)
|
| 1817 |
+
grid.short_name = decode_or_undefined(out_short_name)
|
| 1818 |
+
grid.full_name = decode_or_undefined(out_full_name)
|
| 1819 |
+
grid.package_name = decode_or_undefined(out_package_name)
|
| 1820 |
+
grid.url = decode_or_undefined(out_url)
|
| 1821 |
+
grid.direct_download = direct_download == 1
|
| 1822 |
+
grid.open_license = open_license == 1
|
| 1823 |
+
grid.available = available == 1
|
| 1824 |
+
_clear_proj_error()
|
| 1825 |
+
return grid
|
| 1826 |
+
|
| 1827 |
+
def __str__(self):
|
| 1828 |
+
return self.full_name
|
| 1829 |
+
|
| 1830 |
+
def __repr__(self):
|
| 1831 |
+
return (
|
| 1832 |
+
f"Grid(short_name={self.short_name}, full_name={self.full_name}, "
|
| 1833 |
+
f"package_name={self.package_name}, url={self.url}, "
|
| 1834 |
+
f"direct_download={self.direct_download}, "
|
| 1835 |
+
f"open_license={self.open_license}, available={self.available})"
|
| 1836 |
+
)
|
| 1837 |
+
|
| 1838 |
+
|
| 1839 |
+
cdef dict _COORDINATE_OPERATION_TYPE_MAP = {
|
| 1840 |
+
PJ_TYPE_UNKNOWN: "Unknown",
|
| 1841 |
+
PJ_TYPE_CONVERSION: "Conversion",
|
| 1842 |
+
PJ_TYPE_TRANSFORMATION: "Transformation",
|
| 1843 |
+
PJ_TYPE_CONCATENATED_OPERATION: "Concatenated Operation",
|
| 1844 |
+
PJ_TYPE_OTHER_COORDINATE_OPERATION: "Other Coordinate Operation",
|
| 1845 |
+
}
|
| 1846 |
+
|
| 1847 |
+
cdef dict _PJ_COORDINATE_OPERATION_TYPE_MAP = {
|
| 1848 |
+
CoordinateOperationType.CONVERSION: PJ_TYPE_CONVERSION,
|
| 1849 |
+
CoordinateOperationType.TRANSFORMATION: PJ_TYPE_TRANSFORMATION,
|
| 1850 |
+
CoordinateOperationType.CONCATENATED_OPERATION: PJ_TYPE_CONCATENATED_OPERATION,
|
| 1851 |
+
CoordinateOperationType.OTHER_COORDINATE_OPERATION:
|
| 1852 |
+
PJ_TYPE_OTHER_COORDINATE_OPERATION,
|
| 1853 |
+
}
|
| 1854 |
+
|
| 1855 |
+
cdef class CoordinateOperation(_CRSParts):
|
| 1856 |
+
"""
|
| 1857 |
+
.. versionadded:: 2.2.0
|
| 1858 |
+
|
| 1859 |
+
Coordinate operation for CRS.
|
| 1860 |
+
|
| 1861 |
+
Attributes
|
| 1862 |
+
----------
|
| 1863 |
+
name: str
|
| 1864 |
+
The name of the method(projection) with authority information.
|
| 1865 |
+
method_name: str
|
| 1866 |
+
The method (projection) name.
|
| 1867 |
+
method_auth_name: str
|
| 1868 |
+
The method authority name.
|
| 1869 |
+
method_code: str
|
| 1870 |
+
The method code.
|
| 1871 |
+
is_instantiable: int
|
| 1872 |
+
If 1, a coordinate operation can be instantiated as a PROJ pipeline.
|
| 1873 |
+
This also checks that referenced grids are available.
|
| 1874 |
+
has_ballpark_transformation: int
|
| 1875 |
+
If 1, the coordinate operation has a “ballpark” transformation,
|
| 1876 |
+
that is a very approximate one, due to lack of more accurate transformations.
|
| 1877 |
+
accuracy: float
|
| 1878 |
+
The accuracy (in metre) of a coordinate operation.
|
| 1879 |
+
|
| 1880 |
+
"""
|
| 1881 |
+
def __cinit__(self):
|
| 1882 |
+
self._params = None
|
| 1883 |
+
self._grids = None
|
| 1884 |
+
self._area_of_use = None
|
| 1885 |
+
self.method_name = "undefined"
|
| 1886 |
+
self.method_auth_name = "undefined"
|
| 1887 |
+
self.method_code = "undefined"
|
| 1888 |
+
self.is_instantiable = False
|
| 1889 |
+
self.has_ballpark_transformation = False
|
| 1890 |
+
self.accuracy = float("nan")
|
| 1891 |
+
self._towgs84 = None
|
| 1892 |
+
self._operations = None
|
| 1893 |
+
|
| 1894 |
+
def __init__(self):
|
| 1895 |
+
raise RuntimeError(
|
| 1896 |
+
"CoordinateOperation can only be initialized like "
|
| 1897 |
+
"CoordinateOperation.from_*()'."
|
| 1898 |
+
)
|
| 1899 |
+
|
| 1900 |
+
@staticmethod
|
| 1901 |
+
cdef CoordinateOperation create(PJ_CONTEXT* context, PJ* coord_operation_pj):
|
| 1902 |
+
cdef CoordinateOperation coord_operation = CoordinateOperation.__new__(
|
| 1903 |
+
CoordinateOperation
|
| 1904 |
+
)
|
| 1905 |
+
coord_operation.context = context
|
| 1906 |
+
coord_operation._context_manager = get_context_manager()
|
| 1907 |
+
coord_operation.projobj = coord_operation_pj
|
| 1908 |
+
cdef const char *out_method_name = NULL
|
| 1909 |
+
cdef const char *out_method_auth_name = NULL
|
| 1910 |
+
cdef const char *out_method_code = NULL
|
| 1911 |
+
proj_coordoperation_get_method_info(
|
| 1912 |
+
coord_operation.context,
|
| 1913 |
+
coord_operation.projobj,
|
| 1914 |
+
&out_method_name,
|
| 1915 |
+
&out_method_auth_name,
|
| 1916 |
+
&out_method_code
|
| 1917 |
+
)
|
| 1918 |
+
coord_operation._set_base_info()
|
| 1919 |
+
coord_operation.method_name = decode_or_undefined(out_method_name)
|
| 1920 |
+
coord_operation.method_auth_name = decode_or_undefined(out_method_auth_name)
|
| 1921 |
+
coord_operation.method_code = decode_or_undefined(out_method_code)
|
| 1922 |
+
coord_operation.accuracy = proj_coordoperation_get_accuracy(
|
| 1923 |
+
coord_operation.context,
|
| 1924 |
+
coord_operation.projobj
|
| 1925 |
+
)
|
| 1926 |
+
coord_operation.is_instantiable = proj_coordoperation_is_instantiable(
|
| 1927 |
+
coord_operation.context,
|
| 1928 |
+
coord_operation.projobj
|
| 1929 |
+
) == 1
|
| 1930 |
+
coord_operation.has_ballpark_transformation = \
|
| 1931 |
+
proj_coordoperation_has_ballpark_transformation(
|
| 1932 |
+
coord_operation.context,
|
| 1933 |
+
coord_operation.projobj
|
| 1934 |
+
) == 1
|
| 1935 |
+
cdef PJ_TYPE operation_type = proj_get_type(coord_operation.projobj)
|
| 1936 |
+
coord_operation.type_name = _COORDINATE_OPERATION_TYPE_MAP[operation_type]
|
| 1937 |
+
_clear_proj_error()
|
| 1938 |
+
return coord_operation
|
| 1939 |
+
|
| 1940 |
+
@staticmethod
|
| 1941 |
+
def from_authority(
|
| 1942 |
+
str auth_name not None,
|
| 1943 |
+
code not None,
|
| 1944 |
+
bint use_proj_alternative_grid_names=False,
|
| 1945 |
+
):
|
| 1946 |
+
"""
|
| 1947 |
+
Create a CoordinateOperation from an authority code.
|
| 1948 |
+
|
| 1949 |
+
Parameters
|
| 1950 |
+
----------
|
| 1951 |
+
auth_name: str
|
| 1952 |
+
Name of the authority.
|
| 1953 |
+
code: str or int
|
| 1954 |
+
The code used by the authority.
|
| 1955 |
+
use_proj_alternative_grid_names: bool, default=False
|
| 1956 |
+
Use the PROJ alternative grid names.
|
| 1957 |
+
|
| 1958 |
+
Returns
|
| 1959 |
+
-------
|
| 1960 |
+
CoordinateOperation
|
| 1961 |
+
"""
|
| 1962 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 1963 |
+
cdef PJ* coord_operation_pj = proj_create_from_database(
|
| 1964 |
+
context,
|
| 1965 |
+
cstrencode(auth_name),
|
| 1966 |
+
cstrencode(str(code)),
|
| 1967 |
+
PJ_CATEGORY_COORDINATE_OPERATION,
|
| 1968 |
+
use_proj_alternative_grid_names,
|
| 1969 |
+
NULL,
|
| 1970 |
+
)
|
| 1971 |
+
|
| 1972 |
+
if coord_operation_pj == NULL:
|
| 1973 |
+
raise CRSError(f"Invalid authority or code ({auth_name}, {code})")
|
| 1974 |
+
_clear_proj_error()
|
| 1975 |
+
return CoordinateOperation.create(context, coord_operation_pj)
|
| 1976 |
+
|
| 1977 |
+
@staticmethod
|
| 1978 |
+
def from_epsg(code not None, bint use_proj_alternative_grid_names= False):
|
| 1979 |
+
"""
|
| 1980 |
+
Create a CoordinateOperation from an EPSG code.
|
| 1981 |
+
|
| 1982 |
+
Parameters
|
| 1983 |
+
----------
|
| 1984 |
+
code: str or int
|
| 1985 |
+
The code used by EPSG.
|
| 1986 |
+
use_proj_alternative_grid_names: bool, default=False
|
| 1987 |
+
Use the PROJ alternative grid names.
|
| 1988 |
+
|
| 1989 |
+
Returns
|
| 1990 |
+
-------
|
| 1991 |
+
CoordinateOperation
|
| 1992 |
+
"""
|
| 1993 |
+
return CoordinateOperation.from_authority(
|
| 1994 |
+
"EPSG", code, use_proj_alternative_grid_names
|
| 1995 |
+
)
|
| 1996 |
+
|
| 1997 |
+
@staticmethod
|
| 1998 |
+
def _from_string(str coordinate_operation_string not None):
|
| 1999 |
+
"""
|
| 2000 |
+
Create a CoordinateOperation from a string.
|
| 2001 |
+
|
| 2002 |
+
Example:
|
| 2003 |
+
- urn:ogc:def:coordinateOperation:EPSG::1671
|
| 2004 |
+
|
| 2005 |
+
Parameters
|
| 2006 |
+
----------
|
| 2007 |
+
coordinate_operation_string: str
|
| 2008 |
+
Coordinate operation string.
|
| 2009 |
+
|
| 2010 |
+
Returns
|
| 2011 |
+
-------
|
| 2012 |
+
CoordinateOperation
|
| 2013 |
+
"""
|
| 2014 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2015 |
+
cdef PJ* coord_operation_pj = proj_create(
|
| 2016 |
+
context,
|
| 2017 |
+
cstrencode(coordinate_operation_string)
|
| 2018 |
+
)
|
| 2019 |
+
if (
|
| 2020 |
+
coord_operation_pj == NULL or
|
| 2021 |
+
proj_get_type(coord_operation_pj) not in (
|
| 2022 |
+
PJ_TYPE_CONVERSION,
|
| 2023 |
+
PJ_TYPE_TRANSFORMATION,
|
| 2024 |
+
PJ_TYPE_CONCATENATED_OPERATION,
|
| 2025 |
+
PJ_TYPE_OTHER_COORDINATE_OPERATION,
|
| 2026 |
+
)
|
| 2027 |
+
):
|
| 2028 |
+
proj_destroy(coord_operation_pj)
|
| 2029 |
+
raise CRSError(
|
| 2030 |
+
"Invalid coordinate operation string: "
|
| 2031 |
+
f"{coordinate_operation_string}"
|
| 2032 |
+
)
|
| 2033 |
+
_clear_proj_error()
|
| 2034 |
+
return CoordinateOperation.create(context, coord_operation_pj)
|
| 2035 |
+
|
| 2036 |
+
@staticmethod
|
| 2037 |
+
def from_string(str coordinate_operation_string not None):
|
| 2038 |
+
"""
|
| 2039 |
+
Create a CoordinateOperation from a string.
|
| 2040 |
+
|
| 2041 |
+
Example:
|
| 2042 |
+
- urn:ogc:def:coordinateOperation:EPSG::1671
|
| 2043 |
+
- UTM zone 14N
|
| 2044 |
+
- +proj=utm +zone=14
|
| 2045 |
+
|
| 2046 |
+
Parameters
|
| 2047 |
+
----------
|
| 2048 |
+
coordinate_operation_string: str
|
| 2049 |
+
Coordinate operation string.
|
| 2050 |
+
|
| 2051 |
+
Returns
|
| 2052 |
+
-------
|
| 2053 |
+
CoordinateOperation
|
| 2054 |
+
"""
|
| 2055 |
+
try:
|
| 2056 |
+
return CoordinateOperation._from_string(coordinate_operation_string)
|
| 2057 |
+
except CRSError as crs_err:
|
| 2058 |
+
try:
|
| 2059 |
+
return CoordinateOperation.from_name(coordinate_operation_string)
|
| 2060 |
+
except CRSError:
|
| 2061 |
+
raise crs_err
|
| 2062 |
+
|
| 2063 |
+
@staticmethod
|
| 2064 |
+
def from_json_dict(dict coordinate_operation_dict not None):
|
| 2065 |
+
"""
|
| 2066 |
+
Create CoordinateOperation from a JSON dictionary.
|
| 2067 |
+
|
| 2068 |
+
.. versionadded:: 2.4.0
|
| 2069 |
+
|
| 2070 |
+
Parameters
|
| 2071 |
+
----------
|
| 2072 |
+
coordinate_operation_dict: str
|
| 2073 |
+
CoordinateOperation dictionary.
|
| 2074 |
+
|
| 2075 |
+
Returns
|
| 2076 |
+
-------
|
| 2077 |
+
CoordinateOperation
|
| 2078 |
+
"""
|
| 2079 |
+
return CoordinateOperation._from_string(
|
| 2080 |
+
json.dumps(coordinate_operation_dict, cls=NumpyEncoder)
|
| 2081 |
+
)
|
| 2082 |
+
|
| 2083 |
+
@staticmethod
|
| 2084 |
+
def from_json(str coordinate_operation_json_str not None):
|
| 2085 |
+
"""
|
| 2086 |
+
Create CoordinateOperation from a JSON string.
|
| 2087 |
+
|
| 2088 |
+
.. versionadded:: 2.4.0
|
| 2089 |
+
|
| 2090 |
+
Parameters
|
| 2091 |
+
----------
|
| 2092 |
+
coordinate_operation_json_str: str
|
| 2093 |
+
CoordinateOperation JSON string.
|
| 2094 |
+
|
| 2095 |
+
Returns
|
| 2096 |
+
-------
|
| 2097 |
+
CoordinateOperation
|
| 2098 |
+
"""
|
| 2099 |
+
return CoordinateOperation.from_json_dict(
|
| 2100 |
+
_load_proj_json(coordinate_operation_json_str
|
| 2101 |
+
))
|
| 2102 |
+
|
| 2103 |
+
@staticmethod
|
| 2104 |
+
def from_name(
|
| 2105 |
+
str coordinate_operation_name not None,
|
| 2106 |
+
str auth_name=None,
|
| 2107 |
+
coordinate_operation_type not None=CoordinateOperationType.CONVERSION,
|
| 2108 |
+
):
|
| 2109 |
+
"""
|
| 2110 |
+
.. versionadded:: 2.5.0
|
| 2111 |
+
|
| 2112 |
+
Create a Coordinate Operation from a name.
|
| 2113 |
+
|
| 2114 |
+
Examples:
|
| 2115 |
+
- UTM zone 14N
|
| 2116 |
+
|
| 2117 |
+
Parameters
|
| 2118 |
+
----------
|
| 2119 |
+
coordinate_operation_name: str
|
| 2120 |
+
Coordinate Operation name.
|
| 2121 |
+
auth_name: str, optional
|
| 2122 |
+
The authority name to refine search (e.g. 'EPSG').
|
| 2123 |
+
If None, will search all authorities.
|
| 2124 |
+
coordinate_operation_type: CoordinateOperationType, optional
|
| 2125 |
+
The coordinate operation type to create. Default is
|
| 2126 |
+
``pyproj.crs.enums.CoordinateOperationType.CONVERSION``
|
| 2127 |
+
|
| 2128 |
+
Returns
|
| 2129 |
+
-------
|
| 2130 |
+
CoordinateOperation
|
| 2131 |
+
"""
|
| 2132 |
+
pj_coordinate_operation_type = _PJ_COORDINATE_OPERATION_TYPE_MAP[
|
| 2133 |
+
CoordinateOperationType.create(coordinate_operation_type)
|
| 2134 |
+
]
|
| 2135 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2136 |
+
cdef PJ* coordinate_operation_pj = _from_name(
|
| 2137 |
+
context,
|
| 2138 |
+
coordinate_operation_name,
|
| 2139 |
+
auth_name,
|
| 2140 |
+
<PJ_TYPE>pj_coordinate_operation_type,
|
| 2141 |
+
)
|
| 2142 |
+
if coordinate_operation_pj == NULL:
|
| 2143 |
+
raise CRSError(
|
| 2144 |
+
"Invalid coordinate operation name: "
|
| 2145 |
+
f"{coordinate_operation_name}"
|
| 2146 |
+
)
|
| 2147 |
+
_clear_proj_error()
|
| 2148 |
+
return CoordinateOperation.create(context, coordinate_operation_pj)
|
| 2149 |
+
|
| 2150 |
+
@property
|
| 2151 |
+
def params(self):
|
| 2152 |
+
"""
|
| 2153 |
+
Returns
|
| 2154 |
+
-------
|
| 2155 |
+
list[Param]:
|
| 2156 |
+
The coordinate operation parameters.
|
| 2157 |
+
"""
|
| 2158 |
+
if self._params is not None:
|
| 2159 |
+
return self._params
|
| 2160 |
+
self._params = []
|
| 2161 |
+
cdef int num_params = 0
|
| 2162 |
+
num_params = proj_coordoperation_get_param_count(
|
| 2163 |
+
self.context,
|
| 2164 |
+
self.projobj
|
| 2165 |
+
)
|
| 2166 |
+
for param_idx from 0 <= param_idx < num_params:
|
| 2167 |
+
self._params.append(
|
| 2168 |
+
Param.create(
|
| 2169 |
+
self.context,
|
| 2170 |
+
self.projobj,
|
| 2171 |
+
param_idx
|
| 2172 |
+
)
|
| 2173 |
+
)
|
| 2174 |
+
_clear_proj_error()
|
| 2175 |
+
return self._params
|
| 2176 |
+
|
| 2177 |
+
@property
|
| 2178 |
+
def grids(self):
|
| 2179 |
+
"""
|
| 2180 |
+
Returns
|
| 2181 |
+
-------
|
| 2182 |
+
list[Grid]:
|
| 2183 |
+
The coordinate operation grids.
|
| 2184 |
+
"""
|
| 2185 |
+
if self._grids is not None:
|
| 2186 |
+
return self._grids
|
| 2187 |
+
self._grids = []
|
| 2188 |
+
cdef int num_grids = 0
|
| 2189 |
+
num_grids = proj_coordoperation_get_grid_used_count(
|
| 2190 |
+
self.context,
|
| 2191 |
+
self.projobj
|
| 2192 |
+
)
|
| 2193 |
+
for grid_idx from 0 <= grid_idx < num_grids:
|
| 2194 |
+
self._grids.append(
|
| 2195 |
+
Grid.create(
|
| 2196 |
+
self.context,
|
| 2197 |
+
self.projobj,
|
| 2198 |
+
grid_idx
|
| 2199 |
+
)
|
| 2200 |
+
)
|
| 2201 |
+
_clear_proj_error()
|
| 2202 |
+
return self._grids
|
| 2203 |
+
|
| 2204 |
+
@property
|
| 2205 |
+
def area_of_use(self):
|
| 2206 |
+
"""
|
| 2207 |
+
Returns
|
| 2208 |
+
-------
|
| 2209 |
+
AreaOfUse:
|
| 2210 |
+
The area of use object with associated attributes.
|
| 2211 |
+
"""
|
| 2212 |
+
if self._area_of_use is not None:
|
| 2213 |
+
return self._area_of_use
|
| 2214 |
+
self._area_of_use = create_area_of_use(self.context, self.projobj)
|
| 2215 |
+
return self._area_of_use
|
| 2216 |
+
|
| 2217 |
+
def to_proj4(self, version not None=ProjVersion.PROJ_5, bint pretty=False):
|
| 2218 |
+
"""
|
| 2219 |
+
Convert the projection to a PROJ string.
|
| 2220 |
+
|
| 2221 |
+
.. versionadded:: 3.1.0 pretty
|
| 2222 |
+
|
| 2223 |
+
Parameters
|
| 2224 |
+
----------
|
| 2225 |
+
version: pyproj.enums.ProjVersion, default=pyproj.enums.ProjVersion.PROJ_5
|
| 2226 |
+
The version of the PROJ string output.
|
| 2227 |
+
pretty: bool, default=False
|
| 2228 |
+
If True, it will set the output to be a multiline string.
|
| 2229 |
+
|
| 2230 |
+
Returns
|
| 2231 |
+
-------
|
| 2232 |
+
str:
|
| 2233 |
+
The PROJ string.
|
| 2234 |
+
|
| 2235 |
+
"""
|
| 2236 |
+
return _to_proj4(self.context, self.projobj, version=version, pretty=pretty)
|
| 2237 |
+
|
| 2238 |
+
@property
|
| 2239 |
+
def towgs84(self):
|
| 2240 |
+
"""
|
| 2241 |
+
Returns
|
| 2242 |
+
-------
|
| 2243 |
+
list[float]:
|
| 2244 |
+
A list of 3 or 7 towgs84 values if they exist.
|
| 2245 |
+
|
| 2246 |
+
"""
|
| 2247 |
+
if self._towgs84 is not None:
|
| 2248 |
+
return self._towgs84
|
| 2249 |
+
towgs84_dict = OrderedDict(
|
| 2250 |
+
(
|
| 2251 |
+
('X-axis translation', None),
|
| 2252 |
+
('Y-axis translation', None),
|
| 2253 |
+
('Z-axis translation', None),
|
| 2254 |
+
('X-axis rotation', None),
|
| 2255 |
+
('Y-axis rotation', None),
|
| 2256 |
+
('Z-axis rotation', None),
|
| 2257 |
+
('Scale difference', None),
|
| 2258 |
+
)
|
| 2259 |
+
)
|
| 2260 |
+
for param in self.params:
|
| 2261 |
+
if param.name in towgs84_dict:
|
| 2262 |
+
towgs84_dict[param.name] = param.value
|
| 2263 |
+
self._towgs84 = [val for val in towgs84_dict.values() if val is not None]
|
| 2264 |
+
return self._towgs84
|
| 2265 |
+
|
| 2266 |
+
@property
|
| 2267 |
+
def operations(self):
|
| 2268 |
+
"""
|
| 2269 |
+
.. versionadded:: 2.4.0
|
| 2270 |
+
|
| 2271 |
+
Returns
|
| 2272 |
+
-------
|
| 2273 |
+
tuple[CoordinateOperation]:
|
| 2274 |
+
The operations in a concatenated operation.
|
| 2275 |
+
|
| 2276 |
+
"""
|
| 2277 |
+
if self._operations is not None:
|
| 2278 |
+
return self._operations
|
| 2279 |
+
self._operations = _get_concatenated_operations(self.context, self.projobj)
|
| 2280 |
+
return self._operations
|
| 2281 |
+
|
| 2282 |
+
def __repr__(self):
|
| 2283 |
+
return (
|
| 2284 |
+
f"<Coordinate Operation: {self.type_name}>\n"
|
| 2285 |
+
f"Name: {self.name}\n"
|
| 2286 |
+
f"Method: {self.method_name}\n"
|
| 2287 |
+
f"Area of Use:\n{self.area_of_use or '- undefined'}"
|
| 2288 |
+
)
|
| 2289 |
+
|
| 2290 |
+
AuthorityMatchInfo = namedtuple(
|
| 2291 |
+
"AuthorityMatchInfo",
|
| 2292 |
+
[
|
| 2293 |
+
"auth_name",
|
| 2294 |
+
"code",
|
| 2295 |
+
"confidence",
|
| 2296 |
+
],
|
| 2297 |
+
)
|
| 2298 |
+
AuthorityMatchInfo.__doc__ = """
|
| 2299 |
+
.. versionadded:: 3.2.0
|
| 2300 |
+
|
| 2301 |
+
CRS Authority Match Information
|
| 2302 |
+
|
| 2303 |
+
Parameters
|
| 2304 |
+
----------
|
| 2305 |
+
auth_name: str
|
| 2306 |
+
Authority name.
|
| 2307 |
+
code: str
|
| 2308 |
+
Object code.
|
| 2309 |
+
confidence: int
|
| 2310 |
+
Confidence that this CRS matches
|
| 2311 |
+
the authority and code.
|
| 2312 |
+
"""
|
| 2313 |
+
|
| 2314 |
+
|
| 2315 |
+
cdef dict _CRS_TYPE_MAP = {
|
| 2316 |
+
PJ_TYPE_UNKNOWN: "Unknown CRS",
|
| 2317 |
+
PJ_TYPE_CRS: "CRS",
|
| 2318 |
+
PJ_TYPE_GEODETIC_CRS: "Geodetic CRS",
|
| 2319 |
+
PJ_TYPE_GEOCENTRIC_CRS: "Geocentric CRS",
|
| 2320 |
+
PJ_TYPE_GEOGRAPHIC_CRS: "Geographic CRS",
|
| 2321 |
+
PJ_TYPE_GEOGRAPHIC_2D_CRS: "Geographic 2D CRS",
|
| 2322 |
+
PJ_TYPE_GEOGRAPHIC_3D_CRS: "Geographic 3D CRS",
|
| 2323 |
+
PJ_TYPE_VERTICAL_CRS: "Vertical CRS",
|
| 2324 |
+
PJ_TYPE_PROJECTED_CRS: "Projected CRS",
|
| 2325 |
+
PJ_TYPE_COMPOUND_CRS: "Compound CRS",
|
| 2326 |
+
PJ_TYPE_TEMPORAL_CRS: "Temporal CRS",
|
| 2327 |
+
PJ_TYPE_ENGINEERING_CRS: "Engineering CRS",
|
| 2328 |
+
PJ_TYPE_BOUND_CRS: "Bound CRS",
|
| 2329 |
+
PJ_TYPE_OTHER_CRS: "Other CRS",
|
| 2330 |
+
PJ_TYPE_DERIVED_PROJECTED_CRS: "Derived Projected CRS",
|
| 2331 |
+
}
|
| 2332 |
+
|
| 2333 |
+
|
| 2334 |
+
cdef class _CRS(Base):
|
| 2335 |
+
"""
|
| 2336 |
+
.. versionadded:: 2.0.0
|
| 2337 |
+
|
| 2338 |
+
The cython CRS class to be used as the base for the
|
| 2339 |
+
python CRS class.
|
| 2340 |
+
"""
|
| 2341 |
+
def __cinit__(self):
|
| 2342 |
+
self._context_manager = None
|
| 2343 |
+
self._ellipsoid = None
|
| 2344 |
+
self._area_of_use = None
|
| 2345 |
+
self._prime_meridian = None
|
| 2346 |
+
self._datum = None
|
| 2347 |
+
self._sub_crs_list = None
|
| 2348 |
+
self._source_crs = None
|
| 2349 |
+
self._target_crs = None
|
| 2350 |
+
self._geodetic_crs = None
|
| 2351 |
+
self._coordinate_system = None
|
| 2352 |
+
self._coordinate_operation = None
|
| 2353 |
+
self._type_name = None
|
| 2354 |
+
|
| 2355 |
+
def __init__(self, str proj_string):
|
| 2356 |
+
self.context = pyproj_context_create()
|
| 2357 |
+
self._context_manager = get_context_manager()
|
| 2358 |
+
# initialize projection
|
| 2359 |
+
self.projobj = proj_create(
|
| 2360 |
+
self.context,
|
| 2361 |
+
cstrencode(proj_string),
|
| 2362 |
+
)
|
| 2363 |
+
if self.projobj == NULL:
|
| 2364 |
+
raise CRSError(f"Invalid projection: {proj_string}")
|
| 2365 |
+
# make sure the input is a CRS
|
| 2366 |
+
if not proj_is_crs(self.projobj):
|
| 2367 |
+
raise CRSError(f"Input is not a CRS: {proj_string}")
|
| 2368 |
+
# set proj information
|
| 2369 |
+
self.srs = proj_string
|
| 2370 |
+
self._type = proj_get_type(self.projobj)
|
| 2371 |
+
self._set_base_info()
|
| 2372 |
+
_clear_proj_error()
|
| 2373 |
+
|
| 2374 |
+
@property
|
| 2375 |
+
def type_name(self):
|
| 2376 |
+
"""
|
| 2377 |
+
Returns
|
| 2378 |
+
-------
|
| 2379 |
+
str:
|
| 2380 |
+
The name of the type of the CRS object.
|
| 2381 |
+
"""
|
| 2382 |
+
if self._type_name is not None:
|
| 2383 |
+
return self._type_name
|
| 2384 |
+
self._type_name = _CRS_TYPE_MAP[self._type]
|
| 2385 |
+
if not self.is_derived or self._type in (
|
| 2386 |
+
PJ_TYPE_PROJECTED_CRS,
|
| 2387 |
+
PJ_TYPE_DERIVED_PROJECTED_CRS,
|
| 2388 |
+
):
|
| 2389 |
+
# Projected CRS are derived by definition
|
| 2390 |
+
# https://github.com/OSGeo/PROJ/issues/3525#issuecomment-1365790999
|
| 2391 |
+
return self._type_name
|
| 2392 |
+
|
| 2393 |
+
self._type_name = f"Derived {self._type_name}"
|
| 2394 |
+
return self._type_name
|
| 2395 |
+
|
| 2396 |
+
@property
|
| 2397 |
+
def axis_info(self):
|
| 2398 |
+
"""
|
| 2399 |
+
Retrieves all relevant axis information in the CRS.
|
| 2400 |
+
If it is a Bound CRS, it gets the axis list from the Source CRS.
|
| 2401 |
+
If it is a Compound CRS, it gets the axis list from the Sub CRS list.
|
| 2402 |
+
|
| 2403 |
+
Returns
|
| 2404 |
+
-------
|
| 2405 |
+
list[Axis]:
|
| 2406 |
+
The list of axis information.
|
| 2407 |
+
"""
|
| 2408 |
+
axis_info_list = []
|
| 2409 |
+
if self.coordinate_system:
|
| 2410 |
+
axis_info_list.extend(self.coordinate_system.axis_list)
|
| 2411 |
+
elif self.is_bound and self.source_crs:
|
| 2412 |
+
axis_info_list.extend(self.source_crs.axis_info)
|
| 2413 |
+
else:
|
| 2414 |
+
for sub_crs in self.sub_crs_list:
|
| 2415 |
+
axis_info_list.extend(sub_crs.axis_info)
|
| 2416 |
+
return axis_info_list
|
| 2417 |
+
|
| 2418 |
+
@property
|
| 2419 |
+
def area_of_use(self):
|
| 2420 |
+
"""
|
| 2421 |
+
Returns
|
| 2422 |
+
-------
|
| 2423 |
+
AreaOfUse:
|
| 2424 |
+
The area of use object with associated attributes.
|
| 2425 |
+
"""
|
| 2426 |
+
if self._area_of_use is not None:
|
| 2427 |
+
return self._area_of_use
|
| 2428 |
+
self._area_of_use = create_area_of_use(self.context, self.projobj)
|
| 2429 |
+
return self._area_of_use
|
| 2430 |
+
|
| 2431 |
+
@property
|
| 2432 |
+
def ellipsoid(self):
|
| 2433 |
+
"""
|
| 2434 |
+
.. versionadded:: 2.2.0
|
| 2435 |
+
|
| 2436 |
+
Returns
|
| 2437 |
+
-------
|
| 2438 |
+
Ellipsoid:
|
| 2439 |
+
The ellipsoid object with associated attributes.
|
| 2440 |
+
"""
|
| 2441 |
+
if self._ellipsoid is not None:
|
| 2442 |
+
return None if self._ellipsoid is False else self._ellipsoid
|
| 2443 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2444 |
+
cdef PJ* ellipsoid_pj = proj_get_ellipsoid(
|
| 2445 |
+
context,
|
| 2446 |
+
self.projobj
|
| 2447 |
+
)
|
| 2448 |
+
_clear_proj_error()
|
| 2449 |
+
if ellipsoid_pj == NULL:
|
| 2450 |
+
self._ellipsoid = False
|
| 2451 |
+
return None
|
| 2452 |
+
self._ellipsoid = Ellipsoid.create(context, ellipsoid_pj)
|
| 2453 |
+
return self._ellipsoid
|
| 2454 |
+
|
| 2455 |
+
@property
|
| 2456 |
+
def prime_meridian(self):
|
| 2457 |
+
"""
|
| 2458 |
+
.. versionadded:: 2.2.0
|
| 2459 |
+
|
| 2460 |
+
Returns
|
| 2461 |
+
-------
|
| 2462 |
+
PrimeMeridian:
|
| 2463 |
+
The prime meridian object with associated attributes.
|
| 2464 |
+
"""
|
| 2465 |
+
if self._prime_meridian is not None:
|
| 2466 |
+
return None if self._prime_meridian is True else self._prime_meridian
|
| 2467 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2468 |
+
cdef PJ* prime_meridian_pj = proj_get_prime_meridian(
|
| 2469 |
+
context,
|
| 2470 |
+
self.projobj,
|
| 2471 |
+
)
|
| 2472 |
+
_clear_proj_error()
|
| 2473 |
+
if prime_meridian_pj == NULL:
|
| 2474 |
+
self._prime_meridian = False
|
| 2475 |
+
return None
|
| 2476 |
+
self._prime_meridian = PrimeMeridian.create(context, prime_meridian_pj)
|
| 2477 |
+
return self._prime_meridian
|
| 2478 |
+
|
| 2479 |
+
@property
|
| 2480 |
+
def datum(self):
|
| 2481 |
+
"""
|
| 2482 |
+
.. versionadded:: 2.2.0
|
| 2483 |
+
|
| 2484 |
+
Returns
|
| 2485 |
+
-------
|
| 2486 |
+
Datum
|
| 2487 |
+
"""
|
| 2488 |
+
if self._datum is not None:
|
| 2489 |
+
return None if self._datum is False else self._datum
|
| 2490 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2491 |
+
cdef PJ* datum_pj = proj_crs_get_datum(
|
| 2492 |
+
context,
|
| 2493 |
+
self.projobj,
|
| 2494 |
+
)
|
| 2495 |
+
if datum_pj == NULL:
|
| 2496 |
+
datum_pj = proj_crs_get_horizontal_datum(
|
| 2497 |
+
context,
|
| 2498 |
+
self.projobj,
|
| 2499 |
+
)
|
| 2500 |
+
_clear_proj_error()
|
| 2501 |
+
if datum_pj == NULL:
|
| 2502 |
+
self._datum = False
|
| 2503 |
+
return None
|
| 2504 |
+
self._datum = Datum.create(context, datum_pj)
|
| 2505 |
+
return self._datum
|
| 2506 |
+
|
| 2507 |
+
@property
|
| 2508 |
+
def coordinate_system(self):
|
| 2509 |
+
"""
|
| 2510 |
+
.. versionadded:: 2.2.0
|
| 2511 |
+
|
| 2512 |
+
Returns
|
| 2513 |
+
-------
|
| 2514 |
+
CoordinateSystem
|
| 2515 |
+
"""
|
| 2516 |
+
if self._coordinate_system is not None:
|
| 2517 |
+
return None if self._coordinate_system is False else self._coordinate_system
|
| 2518 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2519 |
+
cdef PJ* coord_system_pj = proj_crs_get_coordinate_system(
|
| 2520 |
+
context,
|
| 2521 |
+
self.projobj
|
| 2522 |
+
)
|
| 2523 |
+
_clear_proj_error()
|
| 2524 |
+
if coord_system_pj == NULL:
|
| 2525 |
+
self._coordinate_system = False
|
| 2526 |
+
return None
|
| 2527 |
+
|
| 2528 |
+
self._coordinate_system = CoordinateSystem.create(
|
| 2529 |
+
context,
|
| 2530 |
+
coord_system_pj,
|
| 2531 |
+
)
|
| 2532 |
+
return self._coordinate_system
|
| 2533 |
+
|
| 2534 |
+
@property
|
| 2535 |
+
def coordinate_operation(self):
|
| 2536 |
+
"""
|
| 2537 |
+
.. versionadded:: 2.2.0
|
| 2538 |
+
|
| 2539 |
+
Returns
|
| 2540 |
+
-------
|
| 2541 |
+
CoordinateOperation
|
| 2542 |
+
"""
|
| 2543 |
+
if self._coordinate_operation is not None:
|
| 2544 |
+
return (
|
| 2545 |
+
None
|
| 2546 |
+
if self._coordinate_operation is False
|
| 2547 |
+
else self._coordinate_operation
|
| 2548 |
+
)
|
| 2549 |
+
|
| 2550 |
+
if not (
|
| 2551 |
+
self.is_bound or self.is_derived
|
| 2552 |
+
):
|
| 2553 |
+
self._coordinate_operation = False
|
| 2554 |
+
return None
|
| 2555 |
+
|
| 2556 |
+
cdef PJ_CONTEXT* context = pyproj_context_create()
|
| 2557 |
+
cdef PJ* coord_pj = proj_crs_get_coordoperation(
|
| 2558 |
+
context,
|
| 2559 |
+
self.projobj
|
| 2560 |
+
)
|
| 2561 |
+
_clear_proj_error()
|
| 2562 |
+
if coord_pj == NULL:
|
| 2563 |
+
self._coordinate_operation = False
|
| 2564 |
+
return None
|
| 2565 |
+
self._coordinate_operation = CoordinateOperation.create(
|
| 2566 |
+
context,
|
| 2567 |
+
coord_pj,
|
| 2568 |
+
)
|
| 2569 |
+
return self._coordinate_operation
|
| 2570 |
+
|
| 2571 |
+
@property
|
| 2572 |
+
def source_crs(self):
|
| 2573 |
+
"""
|
| 2574 |
+
Returns
|
| 2575 |
+
-------
|
| 2576 |
+
_CRS:
|
| 2577 |
+
The base CRS of a BoundCRS or a DerivedCRS/ProjectedCRS.
|
| 2578 |
+
"""
|
| 2579 |
+
if self._source_crs is not None:
|
| 2580 |
+
return None if self._source_crs is False else self._source_crs
|
| 2581 |
+
cdef PJ * projobj = proj_get_source_crs(self.context, self.projobj)
|
| 2582 |
+
_clear_proj_error()
|
| 2583 |
+
if projobj == NULL:
|
| 2584 |
+
self._source_crs = False
|
| 2585 |
+
return None
|
| 2586 |
+
try:
|
| 2587 |
+
self._source_crs = _CRS(_to_wkt(
|
| 2588 |
+
self.context,
|
| 2589 |
+
projobj,
|
| 2590 |
+
version=WktVersion.WKT2_2019,
|
| 2591 |
+
pretty=False,
|
| 2592 |
+
))
|
| 2593 |
+
finally:
|
| 2594 |
+
proj_destroy(projobj)
|
| 2595 |
+
return self._source_crs
|
| 2596 |
+
|
| 2597 |
+
@property
|
| 2598 |
+
def target_crs(self):
|
| 2599 |
+
"""
|
| 2600 |
+
.. versionadded:: 2.2.0
|
| 2601 |
+
|
| 2602 |
+
Returns
|
| 2603 |
+
-------
|
| 2604 |
+
_CRS:
|
| 2605 |
+
The hub CRS of a BoundCRS.
|
| 2606 |
+
"""
|
| 2607 |
+
if self._target_crs is not None:
|
| 2608 |
+
return None if self._target_crs is False else self._target_crs
|
| 2609 |
+
cdef PJ * projobj = proj_get_target_crs(self.context, self.projobj)
|
| 2610 |
+
_clear_proj_error()
|
| 2611 |
+
if projobj == NULL:
|
| 2612 |
+
self._target_crs = False
|
| 2613 |
+
return None
|
| 2614 |
+
try:
|
| 2615 |
+
self._target_crs = _CRS(_to_wkt(
|
| 2616 |
+
self.context,
|
| 2617 |
+
projobj,
|
| 2618 |
+
version=WktVersion.WKT2_2019,
|
| 2619 |
+
pretty=False,
|
| 2620 |
+
))
|
| 2621 |
+
finally:
|
| 2622 |
+
proj_destroy(projobj)
|
| 2623 |
+
return self._target_crs
|
| 2624 |
+
|
| 2625 |
+
@property
|
| 2626 |
+
def sub_crs_list(self):
|
| 2627 |
+
"""
|
| 2628 |
+
If the CRS is a compound CRS, it will return a list of sub CRS objects.
|
| 2629 |
+
|
| 2630 |
+
Returns
|
| 2631 |
+
-------
|
| 2632 |
+
list[_CRS]
|
| 2633 |
+
"""
|
| 2634 |
+
if self._sub_crs_list is not None:
|
| 2635 |
+
return self._sub_crs_list
|
| 2636 |
+
if not self.is_compound:
|
| 2637 |
+
self._sub_crs_list = []
|
| 2638 |
+
return self._sub_crs_list
|
| 2639 |
+
|
| 2640 |
+
cdef int iii = 0
|
| 2641 |
+
cdef PJ * projobj = proj_crs_get_sub_crs(
|
| 2642 |
+
self.context,
|
| 2643 |
+
self.projobj,
|
| 2644 |
+
iii,
|
| 2645 |
+
)
|
| 2646 |
+
self._sub_crs_list = []
|
| 2647 |
+
while projobj != NULL:
|
| 2648 |
+
try:
|
| 2649 |
+
self._sub_crs_list.append(_CRS(_to_wkt(
|
| 2650 |
+
self.context,
|
| 2651 |
+
projobj,
|
| 2652 |
+
version=WktVersion.WKT2_2019,
|
| 2653 |
+
pretty=False,
|
| 2654 |
+
)))
|
| 2655 |
+
finally:
|
| 2656 |
+
proj_destroy(projobj) # deallocate temp proj
|
| 2657 |
+
iii += 1
|
| 2658 |
+
projobj = proj_crs_get_sub_crs(
|
| 2659 |
+
self.context,
|
| 2660 |
+
self.projobj,
|
| 2661 |
+
iii,
|
| 2662 |
+
)
|
| 2663 |
+
_clear_proj_error()
|
| 2664 |
+
return self._sub_crs_list
|
| 2665 |
+
|
| 2666 |
+
@property
|
| 2667 |
+
def geodetic_crs(self):
|
| 2668 |
+
"""
|
| 2669 |
+
.. versionadded:: 2.2.0
|
| 2670 |
+
|
| 2671 |
+
The geodeticCRS / geographicCRS from the CRS.
|
| 2672 |
+
|
| 2673 |
+
Returns
|
| 2674 |
+
-------
|
| 2675 |
+
_CRS
|
| 2676 |
+
"""
|
| 2677 |
+
if self._geodetic_crs is not None:
|
| 2678 |
+
return self._geodetic_crs if self. _geodetic_crs is not False else None
|
| 2679 |
+
cdef PJ * projobj = proj_crs_get_geodetic_crs(self.context, self.projobj)
|
| 2680 |
+
_clear_proj_error()
|
| 2681 |
+
if projobj == NULL:
|
| 2682 |
+
self._geodetic_crs = False
|
| 2683 |
+
return None
|
| 2684 |
+
try:
|
| 2685 |
+
self._geodetic_crs = _CRS(_to_wkt(
|
| 2686 |
+
self.context,
|
| 2687 |
+
projobj,
|
| 2688 |
+
version=WktVersion.WKT2_2019,
|
| 2689 |
+
pretty=False,
|
| 2690 |
+
))
|
| 2691 |
+
finally:
|
| 2692 |
+
proj_destroy(projobj) # deallocate temp proj
|
| 2693 |
+
return self._geodetic_crs
|
| 2694 |
+
|
| 2695 |
+
def to_proj4(self, version=ProjVersion.PROJ_4):
|
| 2696 |
+
"""
|
| 2697 |
+
Convert the projection to a PROJ string.
|
| 2698 |
+
|
| 2699 |
+
.. warning:: You will likely lose important projection
|
| 2700 |
+
information when converting to a PROJ string from
|
| 2701 |
+
another format. See:
|
| 2702 |
+
https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems
|
| 2703 |
+
|
| 2704 |
+
Parameters
|
| 2705 |
+
----------
|
| 2706 |
+
version: pyproj.enums.ProjVersion, default=pyproj.enums.ProjVersion.PROJ_4
|
| 2707 |
+
The version of the PROJ string output.
|
| 2708 |
+
|
| 2709 |
+
Returns
|
| 2710 |
+
-------
|
| 2711 |
+
str
|
| 2712 |
+
""" # noqa: E501
|
| 2713 |
+
warnings.warn(
|
| 2714 |
+
"You will likely lose important projection information when "
|
| 2715 |
+
"converting to a PROJ string from another format. See: "
|
| 2716 |
+
"https://proj.org/faq.html#what-is-the-best-format-for-describing-"
|
| 2717 |
+
"coordinate-reference-systems"
|
| 2718 |
+
)
|
| 2719 |
+
return _to_proj4(self.context, self.projobj, version=version, pretty=False)
|
| 2720 |
+
|
| 2721 |
+
def to_epsg(self, int min_confidence=70):
|
| 2722 |
+
"""
|
| 2723 |
+
Return the EPSG code best matching the CRS
|
| 2724 |
+
or None if it a match is not found.
|
| 2725 |
+
|
| 2726 |
+
Example:
|
| 2727 |
+
|
| 2728 |
+
>>> from pyproj import CRS
|
| 2729 |
+
>>> ccs = CRS("EPSG:4328")
|
| 2730 |
+
>>> ccs.to_epsg()
|
| 2731 |
+
4328
|
| 2732 |
+
|
| 2733 |
+
If the CRS is bound, you can attempt to get an epsg code from
|
| 2734 |
+
the source CRS:
|
| 2735 |
+
|
| 2736 |
+
>>> from pyproj import CRS
|
| 2737 |
+
>>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
|
| 2738 |
+
>>> ccs.to_epsg()
|
| 2739 |
+
>>> ccs.source_crs.to_epsg()
|
| 2740 |
+
4978
|
| 2741 |
+
>>> ccs == CRS.from_epsg(4978)
|
| 2742 |
+
False
|
| 2743 |
+
|
| 2744 |
+
Parameters
|
| 2745 |
+
----------
|
| 2746 |
+
min_confidence: int, default=70
|
| 2747 |
+
A value between 0-100 where 100 is the most confident.
|
| 2748 |
+
:ref:`min_confidence`
|
| 2749 |
+
|
| 2750 |
+
|
| 2751 |
+
Returns
|
| 2752 |
+
-------
|
| 2753 |
+
int | None:
|
| 2754 |
+
The best matching EPSG code matching the confidence level.
|
| 2755 |
+
"""
|
| 2756 |
+
auth_info = self.to_authority(
|
| 2757 |
+
auth_name="EPSG",
|
| 2758 |
+
min_confidence=min_confidence
|
| 2759 |
+
)
|
| 2760 |
+
if auth_info is not None and auth_info[0].upper() == "EPSG":
|
| 2761 |
+
return int(auth_info[1])
|
| 2762 |
+
return None
|
| 2763 |
+
|
| 2764 |
+
def to_authority(self, str auth_name=None, int min_confidence=70):
|
| 2765 |
+
"""
|
| 2766 |
+
.. versionadded:: 2.2.0
|
| 2767 |
+
|
| 2768 |
+
Return the authority name and code best matching the CRS
|
| 2769 |
+
or None if it a match is not found.
|
| 2770 |
+
|
| 2771 |
+
Example:
|
| 2772 |
+
|
| 2773 |
+
>>> from pyproj import CRS
|
| 2774 |
+
>>> ccs = CRS("EPSG:4328")
|
| 2775 |
+
>>> ccs.to_authority()
|
| 2776 |
+
('EPSG', '4328')
|
| 2777 |
+
|
| 2778 |
+
If the CRS is bound, you can get an authority from
|
| 2779 |
+
the source CRS:
|
| 2780 |
+
|
| 2781 |
+
>>> from pyproj import CRS
|
| 2782 |
+
>>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
|
| 2783 |
+
>>> ccs.to_authority()
|
| 2784 |
+
>>> ccs.source_crs.to_authority()
|
| 2785 |
+
('EPSG', '4978')
|
| 2786 |
+
>>> ccs == CRS.from_authorty('EPSG', '4978')
|
| 2787 |
+
False
|
| 2788 |
+
|
| 2789 |
+
Parameters
|
| 2790 |
+
----------
|
| 2791 |
+
auth_name: str, optional
|
| 2792 |
+
The name of the authority to filter by.
|
| 2793 |
+
min_confidence: int, default=70
|
| 2794 |
+
A value between 0-100 where 100 is the most confident.
|
| 2795 |
+
:ref:`min_confidence`
|
| 2796 |
+
|
| 2797 |
+
Returns
|
| 2798 |
+
-------
|
| 2799 |
+
tuple(str, str) or None:
|
| 2800 |
+
The best matching (<auth_name>, <code>) for the confidence level.
|
| 2801 |
+
"""
|
| 2802 |
+
try:
|
| 2803 |
+
authority = self.list_authority(
|
| 2804 |
+
auth_name=auth_name, min_confidence=min_confidence,
|
| 2805 |
+
)[0]
|
| 2806 |
+
return authority.auth_name, authority.code
|
| 2807 |
+
except IndexError:
|
| 2808 |
+
return None
|
| 2809 |
+
|
| 2810 |
+
def list_authority(self, str auth_name=None, int min_confidence=70):
|
| 2811 |
+
"""
|
| 2812 |
+
.. versionadded:: 3.2.0
|
| 2813 |
+
|
| 2814 |
+
Return the authority names and codes best matching the CRS.
|
| 2815 |
+
|
| 2816 |
+
Example:
|
| 2817 |
+
|
| 2818 |
+
>>> from pyproj import CRS
|
| 2819 |
+
>>> ccs = CRS("EPSG:4328")
|
| 2820 |
+
>>> ccs.list_authority()
|
| 2821 |
+
[AuthorityMatchInfo(auth_name='EPSG', code='4326', confidence=100)]
|
| 2822 |
+
|
| 2823 |
+
If the CRS is bound, you can get an authority from
|
| 2824 |
+
the source CRS:
|
| 2825 |
+
|
| 2826 |
+
>>> from pyproj import CRS
|
| 2827 |
+
>>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
|
| 2828 |
+
>>> ccs.list_authority()
|
| 2829 |
+
[]
|
| 2830 |
+
>>> ccs.source_crs.list_authority()
|
| 2831 |
+
[AuthorityMatchInfo(auth_name='EPSG', code='4978', confidence=70)]
|
| 2832 |
+
>>> ccs == CRS.from_authorty('EPSG', '4978')
|
| 2833 |
+
False
|
| 2834 |
+
|
| 2835 |
+
Parameters
|
| 2836 |
+
----------
|
| 2837 |
+
auth_name: str, optional
|
| 2838 |
+
The name of the authority to filter by.
|
| 2839 |
+
min_confidence: int, default=70
|
| 2840 |
+
A value between 0-100 where 100 is the most confident.
|
| 2841 |
+
:ref:`min_confidence`
|
| 2842 |
+
|
| 2843 |
+
Returns
|
| 2844 |
+
-------
|
| 2845 |
+
list[AuthorityMatchInfo]:
|
| 2846 |
+
List of authority matches for the CRS.
|
| 2847 |
+
"""
|
| 2848 |
+
# get list of possible matching projections
|
| 2849 |
+
cdef PJ_OBJ_LIST *proj_list = NULL
|
| 2850 |
+
cdef int *c_out_confidence_list = NULL
|
| 2851 |
+
cdef int num_proj_objects = -9999
|
| 2852 |
+
cdef bytes b_auth_name
|
| 2853 |
+
cdef char *user_auth_name = NULL
|
| 2854 |
+
cdef int iii = 0
|
| 2855 |
+
|
| 2856 |
+
if auth_name is not None:
|
| 2857 |
+
b_auth_name = cstrencode(auth_name)
|
| 2858 |
+
user_auth_name = b_auth_name
|
| 2859 |
+
|
| 2860 |
+
out_confidence_list = []
|
| 2861 |
+
try:
|
| 2862 |
+
proj_list = proj_identify(
|
| 2863 |
+
self.context,
|
| 2864 |
+
self.projobj,
|
| 2865 |
+
user_auth_name,
|
| 2866 |
+
NULL,
|
| 2867 |
+
&c_out_confidence_list
|
| 2868 |
+
)
|
| 2869 |
+
if proj_list != NULL:
|
| 2870 |
+
num_proj_objects = proj_list_get_count(proj_list)
|
| 2871 |
+
if c_out_confidence_list != NULL and num_proj_objects > 0:
|
| 2872 |
+
out_confidence_list = [
|
| 2873 |
+
c_out_confidence_list[iii] for iii in range(num_proj_objects)
|
| 2874 |
+
]
|
| 2875 |
+
finally:
|
| 2876 |
+
if c_out_confidence_list != NULL:
|
| 2877 |
+
proj_int_list_destroy(c_out_confidence_list)
|
| 2878 |
+
_clear_proj_error()
|
| 2879 |
+
|
| 2880 |
+
# retrieve the best matching projection
|
| 2881 |
+
cdef PJ* proj = NULL
|
| 2882 |
+
cdef const char* code
|
| 2883 |
+
cdef const char* out_auth_name
|
| 2884 |
+
authority_list = []
|
| 2885 |
+
try:
|
| 2886 |
+
for iii in range(num_proj_objects):
|
| 2887 |
+
if out_confidence_list[iii] < min_confidence:
|
| 2888 |
+
continue
|
| 2889 |
+
proj = proj_list_get(self.context, proj_list, iii)
|
| 2890 |
+
code = proj_get_id_code(proj, 0)
|
| 2891 |
+
out_auth_name = proj_get_id_auth_name(proj, 0)
|
| 2892 |
+
if out_auth_name != NULL and code != NULL:
|
| 2893 |
+
authority_list.append(
|
| 2894 |
+
AuthorityMatchInfo(
|
| 2895 |
+
out_auth_name,
|
| 2896 |
+
code,
|
| 2897 |
+
out_confidence_list[iii]
|
| 2898 |
+
)
|
| 2899 |
+
)
|
| 2900 |
+
# at this point, the auth name is copied and we can release the proj object
|
| 2901 |
+
proj_destroy(proj)
|
| 2902 |
+
proj = NULL
|
| 2903 |
+
finally:
|
| 2904 |
+
# If there was an error we have to call proj_destroy
|
| 2905 |
+
# If there was none, calling it on NULL does nothing
|
| 2906 |
+
proj_destroy(proj)
|
| 2907 |
+
proj_list_destroy(proj_list)
|
| 2908 |
+
_clear_proj_error()
|
| 2909 |
+
return authority_list
|
| 2910 |
+
|
| 2911 |
+
def to_3d(self, str name=None):
|
| 2912 |
+
"""
|
| 2913 |
+
.. versionadded:: 3.1.0
|
| 2914 |
+
|
| 2915 |
+
Convert the current CRS to the 3D version if it makes sense.
|
| 2916 |
+
|
| 2917 |
+
New vertical axis attributes:
|
| 2918 |
+
- ellipsoidal height
|
| 2919 |
+
- oriented upwards
|
| 2920 |
+
- metre units
|
| 2921 |
+
|
| 2922 |
+
Parameters
|
| 2923 |
+
----------
|
| 2924 |
+
name: str, optional
|
| 2925 |
+
CRS name. If None, it will use the name of the original CRS.
|
| 2926 |
+
|
| 2927 |
+
Returns
|
| 2928 |
+
-------
|
| 2929 |
+
_CRS
|
| 2930 |
+
"""
|
| 2931 |
+
cdef char* c_name = NULL
|
| 2932 |
+
cdef bytes b_name
|
| 2933 |
+
if name is not None:
|
| 2934 |
+
b_name = cstrencode(name)
|
| 2935 |
+
c_name = b_name
|
| 2936 |
+
|
| 2937 |
+
cdef PJ * projobj = proj_crs_promote_to_3D(
|
| 2938 |
+
self.context, c_name, self.projobj
|
| 2939 |
+
)
|
| 2940 |
+
_clear_proj_error()
|
| 2941 |
+
if projobj == NULL:
|
| 2942 |
+
return self
|
| 2943 |
+
try:
|
| 2944 |
+
crs_3d = _CRS(_to_wkt(
|
| 2945 |
+
self.context,
|
| 2946 |
+
projobj,
|
| 2947 |
+
version=WktVersion.WKT2_2019,
|
| 2948 |
+
pretty=False,
|
| 2949 |
+
))
|
| 2950 |
+
finally:
|
| 2951 |
+
proj_destroy(projobj)
|
| 2952 |
+
return crs_3d
|
| 2953 |
+
|
| 2954 |
+
def to_2d(self, str name=None):
|
| 2955 |
+
"""
|
| 2956 |
+
.. versionadded:: 3.6.0
|
| 2957 |
+
|
| 2958 |
+
Convert the current CRS to the 2D version if it makes sense.
|
| 2959 |
+
|
| 2960 |
+
Parameters
|
| 2961 |
+
----------
|
| 2962 |
+
name: str, optional
|
| 2963 |
+
CRS name. If None, it will use the name of the original CRS.
|
| 2964 |
+
|
| 2965 |
+
Returns
|
| 2966 |
+
-------
|
| 2967 |
+
_CRS
|
| 2968 |
+
"""
|
| 2969 |
+
cdef char* c_name = NULL
|
| 2970 |
+
cdef bytes b_name
|
| 2971 |
+
if name is not None:
|
| 2972 |
+
b_name = cstrencode(name)
|
| 2973 |
+
c_name = b_name
|
| 2974 |
+
|
| 2975 |
+
cdef PJ * projobj = proj_crs_demote_to_2D(
|
| 2976 |
+
self.context, c_name, self.projobj
|
| 2977 |
+
)
|
| 2978 |
+
_clear_proj_error()
|
| 2979 |
+
if projobj == NULL:
|
| 2980 |
+
return self
|
| 2981 |
+
try:
|
| 2982 |
+
crs_2d = _CRS(_to_wkt(
|
| 2983 |
+
self.context,
|
| 2984 |
+
projobj,
|
| 2985 |
+
version=WktVersion.WKT2_2019,
|
| 2986 |
+
pretty=False,
|
| 2987 |
+
))
|
| 2988 |
+
finally:
|
| 2989 |
+
proj_destroy(projobj)
|
| 2990 |
+
return crs_2d
|
| 2991 |
+
|
| 2992 |
+
def _is_crs_property(
|
| 2993 |
+
self, str property_name, tuple property_types, int sub_crs_index=0
|
| 2994 |
+
):
|
| 2995 |
+
"""
|
| 2996 |
+
.. versionadded:: 2.2.0
|
| 2997 |
+
|
| 2998 |
+
This method will check for a property on the CRS.
|
| 2999 |
+
It will check if it has the property on the sub CRS
|
| 3000 |
+
if it is a compound CRS and will check if the source CRS
|
| 3001 |
+
has the property if it is a bound CRS.
|
| 3002 |
+
|
| 3003 |
+
Parameters
|
| 3004 |
+
----------
|
| 3005 |
+
property_name: str
|
| 3006 |
+
The name of the CRS property.
|
| 3007 |
+
property_types: tuple(PJ_TYPE)
|
| 3008 |
+
The types to check for for the property.
|
| 3009 |
+
sub_crs_index: int, default=0
|
| 3010 |
+
THe index of the CRS in the sub CRS list.
|
| 3011 |
+
|
| 3012 |
+
Returns
|
| 3013 |
+
-------
|
| 3014 |
+
bool:
|
| 3015 |
+
True if the CRS has this property.
|
| 3016 |
+
"""
|
| 3017 |
+
if self.sub_crs_list:
|
| 3018 |
+
sub_crs = self.sub_crs_list[sub_crs_index]
|
| 3019 |
+
if sub_crs.is_bound:
|
| 3020 |
+
is_property = getattr(sub_crs.source_crs, property_name)
|
| 3021 |
+
else:
|
| 3022 |
+
is_property = getattr(sub_crs, property_name)
|
| 3023 |
+
elif self.is_bound:
|
| 3024 |
+
is_property = getattr(self.source_crs, property_name)
|
| 3025 |
+
else:
|
| 3026 |
+
is_property = self._type in property_types
|
| 3027 |
+
return is_property
|
| 3028 |
+
|
| 3029 |
+
@property
|
| 3030 |
+
def is_geographic(self):
|
| 3031 |
+
"""
|
| 3032 |
+
This checks if the CRS is geographic.
|
| 3033 |
+
It will check if it has a geographic CRS
|
| 3034 |
+
in the sub CRS if it is a compound CRS and will check if
|
| 3035 |
+
the source CRS is geographic if it is a bound CRS.
|
| 3036 |
+
|
| 3037 |
+
Returns
|
| 3038 |
+
-------
|
| 3039 |
+
bool:
|
| 3040 |
+
True if the CRS is in geographic (lon/lat) coordinates.
|
| 3041 |
+
"""
|
| 3042 |
+
return self._is_crs_property(
|
| 3043 |
+
"is_geographic",
|
| 3044 |
+
(
|
| 3045 |
+
PJ_TYPE_GEOGRAPHIC_CRS,
|
| 3046 |
+
PJ_TYPE_GEOGRAPHIC_2D_CRS,
|
| 3047 |
+
PJ_TYPE_GEOGRAPHIC_3D_CRS
|
| 3048 |
+
)
|
| 3049 |
+
)
|
| 3050 |
+
|
| 3051 |
+
@property
|
| 3052 |
+
def is_projected(self):
|
| 3053 |
+
"""
|
| 3054 |
+
This checks if the CRS is projected.
|
| 3055 |
+
It will check if it has a projected CRS
|
| 3056 |
+
in the sub CRS if it is a compound CRS and will check if
|
| 3057 |
+
the source CRS is projected if it is a bound CRS.
|
| 3058 |
+
|
| 3059 |
+
Returns
|
| 3060 |
+
-------
|
| 3061 |
+
bool:
|
| 3062 |
+
True if CRS is projected.
|
| 3063 |
+
"""
|
| 3064 |
+
return self._is_crs_property(
|
| 3065 |
+
"is_projected",
|
| 3066 |
+
(PJ_TYPE_PROJECTED_CRS,)
|
| 3067 |
+
)
|
| 3068 |
+
|
| 3069 |
+
@property
|
| 3070 |
+
def is_vertical(self):
|
| 3071 |
+
"""
|
| 3072 |
+
.. versionadded:: 2.2.0
|
| 3073 |
+
|
| 3074 |
+
This checks if the CRS is vertical.
|
| 3075 |
+
It will check if it has a vertical CRS
|
| 3076 |
+
in the sub CRS if it is a compound CRS and will check if
|
| 3077 |
+
the source CRS is vertical if it is a bound CRS.
|
| 3078 |
+
|
| 3079 |
+
Returns
|
| 3080 |
+
-------
|
| 3081 |
+
bool:
|
| 3082 |
+
True if CRS is vertical.
|
| 3083 |
+
"""
|
| 3084 |
+
return self._is_crs_property(
|
| 3085 |
+
"is_vertical",
|
| 3086 |
+
(PJ_TYPE_VERTICAL_CRS,),
|
| 3087 |
+
sub_crs_index=1
|
| 3088 |
+
)
|
| 3089 |
+
|
| 3090 |
+
@property
|
| 3091 |
+
def is_bound(self):
|
| 3092 |
+
"""
|
| 3093 |
+
Returns
|
| 3094 |
+
-------
|
| 3095 |
+
bool:
|
| 3096 |
+
True if CRS is bound.
|
| 3097 |
+
"""
|
| 3098 |
+
return self._type == PJ_TYPE_BOUND_CRS
|
| 3099 |
+
|
| 3100 |
+
@property
|
| 3101 |
+
def is_compound(self):
|
| 3102 |
+
"""
|
| 3103 |
+
.. versionadded:: 3.1.0
|
| 3104 |
+
|
| 3105 |
+
Returns
|
| 3106 |
+
-------
|
| 3107 |
+
bool:
|
| 3108 |
+
True if CRS is compound.
|
| 3109 |
+
"""
|
| 3110 |
+
return self._type == PJ_TYPE_COMPOUND_CRS
|
| 3111 |
+
|
| 3112 |
+
@property
|
| 3113 |
+
def is_engineering(self):
|
| 3114 |
+
"""
|
| 3115 |
+
.. versionadded:: 2.2.0
|
| 3116 |
+
|
| 3117 |
+
Returns
|
| 3118 |
+
-------
|
| 3119 |
+
bool:
|
| 3120 |
+
True if CRS is local/engineering.
|
| 3121 |
+
"""
|
| 3122 |
+
return self._type == PJ_TYPE_ENGINEERING_CRS
|
| 3123 |
+
|
| 3124 |
+
@property
|
| 3125 |
+
def is_geocentric(self):
|
| 3126 |
+
"""
|
| 3127 |
+
This checks if the CRS is geocentric and
|
| 3128 |
+
takes into account if the CRS is bound.
|
| 3129 |
+
|
| 3130 |
+
Returns
|
| 3131 |
+
-------
|
| 3132 |
+
bool:
|
| 3133 |
+
True if CRS is in geocentric (x/y) coordinates.
|
| 3134 |
+
"""
|
| 3135 |
+
if self.is_bound:
|
| 3136 |
+
return self.source_crs.is_geocentric
|
| 3137 |
+
return self._type == PJ_TYPE_GEOCENTRIC_CRS
|
| 3138 |
+
|
| 3139 |
+
@property
|
| 3140 |
+
def is_derived(self):
|
| 3141 |
+
"""
|
| 3142 |
+
.. versionadded:: 3.2.0
|
| 3143 |
+
|
| 3144 |
+
Returns
|
| 3145 |
+
-------
|
| 3146 |
+
bool:
|
| 3147 |
+
True if CRS is a Derived CRS.
|
| 3148 |
+
"""
|
| 3149 |
+
return proj_is_derived_crs(self.context, self.projobj) == 1
|
| 3150 |
+
|
| 3151 |
+
def _equals(self, _CRS other, bint ignore_axis_order):
|
| 3152 |
+
if ignore_axis_order:
|
| 3153 |
+
# Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS
|
| 3154 |
+
return proj_is_equivalent_to_with_ctx(
|
| 3155 |
+
self.context,
|
| 3156 |
+
self.projobj,
|
| 3157 |
+
other.projobj,
|
| 3158 |
+
PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS,
|
| 3159 |
+
) == 1
|
| 3160 |
+
return self._is_equivalent(other)
|
| 3161 |
+
|
| 3162 |
+
def equals(self, other, ignore_axis_order=False):
|
| 3163 |
+
"""
|
| 3164 |
+
Check if the projection objects are equivalent.
|
| 3165 |
+
|
| 3166 |
+
Properties
|
| 3167 |
+
----------
|
| 3168 |
+
other: CRS
|
| 3169 |
+
Check if the other object
|
| 3170 |
+
ignore_axis_order: bool, default=False
|
| 3171 |
+
If True, it will compare the CRS class and ignore the axis order.
|
| 3172 |
+
|
| 3173 |
+
Returns
|
| 3174 |
+
-------
|
| 3175 |
+
bool
|
| 3176 |
+
"""
|
| 3177 |
+
if not isinstance(other, _CRS):
|
| 3178 |
+
return False
|
| 3179 |
+
return self._equals(other, ignore_axis_order=ignore_axis_order)
|
| 3180 |
+
|
| 3181 |
+
@property
|
| 3182 |
+
def is_deprecated(self):
|
| 3183 |
+
"""
|
| 3184 |
+
.. versionadded:: 3.7.0
|
| 3185 |
+
|
| 3186 |
+
Check if the CRS is deprecated
|
| 3187 |
+
|
| 3188 |
+
Returns
|
| 3189 |
+
-------
|
| 3190 |
+
bool
|
| 3191 |
+
"""
|
| 3192 |
+
return bool(proj_is_deprecated(self.projobj))
|
| 3193 |
+
|
| 3194 |
+
def get_non_deprecated(self):
|
| 3195 |
+
"""
|
| 3196 |
+
.. versionadded:: 3.7.0
|
| 3197 |
+
|
| 3198 |
+
Return a list of non-deprecated objects related to this.
|
| 3199 |
+
|
| 3200 |
+
Returns
|
| 3201 |
+
-------
|
| 3202 |
+
list[_CRS]
|
| 3203 |
+
"""
|
| 3204 |
+
|
| 3205 |
+
non_deprecated = []
|
| 3206 |
+
|
| 3207 |
+
cdef PJ_OBJ_LIST *proj_list = NULL
|
| 3208 |
+
cdef int num_proj_objects = 0
|
| 3209 |
+
|
| 3210 |
+
proj_list = proj_get_non_deprecated(
|
| 3211 |
+
self.context,
|
| 3212 |
+
self.projobj
|
| 3213 |
+
)
|
| 3214 |
+
if proj_list != NULL:
|
| 3215 |
+
num_proj_objects = proj_list_get_count(proj_list)
|
| 3216 |
+
|
| 3217 |
+
cdef PJ* proj = NULL
|
| 3218 |
+
try:
|
| 3219 |
+
for iii in range(num_proj_objects):
|
| 3220 |
+
proj = proj_list_get(self.context, proj_list, iii)
|
| 3221 |
+
non_deprecated.append(_CRS(_to_wkt(
|
| 3222 |
+
self.context,
|
| 3223 |
+
proj,
|
| 3224 |
+
version=WktVersion.WKT2_2019,
|
| 3225 |
+
pretty=False,
|
| 3226 |
+
)))
|
| 3227 |
+
proj_destroy(proj)
|
| 3228 |
+
proj = NULL
|
| 3229 |
+
finally:
|
| 3230 |
+
# If there was an error we have to call proj_destroy
|
| 3231 |
+
# If there was none, calling it on NULL does nothing
|
| 3232 |
+
proj_destroy(proj)
|
| 3233 |
+
proj_list_destroy(proj_list)
|
| 3234 |
+
_clear_proj_error()
|
| 3235 |
+
|
| 3236 |
+
return non_deprecated
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/_geod.pyi
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, NamedTuple
|
| 2 |
+
|
| 3 |
+
geodesic_version_str: str
|
| 4 |
+
|
| 5 |
+
class GeodIntermediateReturn(NamedTuple):
|
| 6 |
+
npts: int
|
| 7 |
+
del_s: float
|
| 8 |
+
dist: float
|
| 9 |
+
lons: Any
|
| 10 |
+
lats: Any
|
| 11 |
+
azis: Any
|
| 12 |
+
|
| 13 |
+
class Geod:
|
| 14 |
+
initstring: str
|
| 15 |
+
a: float
|
| 16 |
+
b: float
|
| 17 |
+
f: float
|
| 18 |
+
es: float
|
| 19 |
+
sphere: bool
|
| 20 |
+
def __init__(
|
| 21 |
+
self, a: float, f: float, sphere: bool, b: float, es: float
|
| 22 |
+
) -> None: ...
|
| 23 |
+
def __reduce__(self) -> tuple[type[Geod], str]: ...
|
| 24 |
+
def _fwd(
|
| 25 |
+
self,
|
| 26 |
+
lons: Any,
|
| 27 |
+
lats: Any,
|
| 28 |
+
az: Any,
|
| 29 |
+
dist: Any,
|
| 30 |
+
radians: bool = False,
|
| 31 |
+
return_back_azimuth: bool = True,
|
| 32 |
+
) -> None: ...
|
| 33 |
+
def _fwd_point(
|
| 34 |
+
self,
|
| 35 |
+
lons: float,
|
| 36 |
+
lats: float,
|
| 37 |
+
az: float,
|
| 38 |
+
dist: float,
|
| 39 |
+
radians: bool = False,
|
| 40 |
+
return_back_azimuth: bool = True,
|
| 41 |
+
) -> tuple[float, float, float]: ...
|
| 42 |
+
def _inv(
|
| 43 |
+
self,
|
| 44 |
+
lons1: Any,
|
| 45 |
+
lats1: Any,
|
| 46 |
+
lons2: Any,
|
| 47 |
+
lats2: Any,
|
| 48 |
+
radians: bool = False,
|
| 49 |
+
return_back_azimuth: bool = False,
|
| 50 |
+
) -> None: ...
|
| 51 |
+
def _inv_point(
|
| 52 |
+
self,
|
| 53 |
+
lons1: float,
|
| 54 |
+
lats1: float,
|
| 55 |
+
lons2: float,
|
| 56 |
+
lats2: float,
|
| 57 |
+
radians: bool = False,
|
| 58 |
+
return_back_azimuth: bool = False,
|
| 59 |
+
) -> tuple[float, float, float]: ...
|
| 60 |
+
def _inv_or_fwd_intermediate(
|
| 61 |
+
self,
|
| 62 |
+
lon1: float,
|
| 63 |
+
lat1: float,
|
| 64 |
+
lon2_or_azi1: float,
|
| 65 |
+
lat2: float,
|
| 66 |
+
npts: int,
|
| 67 |
+
del_s: float,
|
| 68 |
+
radians: bool,
|
| 69 |
+
initial_idx: int,
|
| 70 |
+
terminus_idx: int,
|
| 71 |
+
flags: int,
|
| 72 |
+
out_lons: Any,
|
| 73 |
+
out_lats: Any,
|
| 74 |
+
out_azis: Any,
|
| 75 |
+
return_back_azimuth: bool,
|
| 76 |
+
is_fwd: bool,
|
| 77 |
+
) -> GeodIntermediateReturn: ...
|
| 78 |
+
def _line_length(self, lons: Any, lats: Any, radians: bool = False) -> float: ...
|
| 79 |
+
def _polygon_area_perimeter(
|
| 80 |
+
self, lons: Any, lats: Any, radians: bool = False
|
| 81 |
+
) -> tuple[float, float]: ...
|
| 82 |
+
|
| 83 |
+
def reverse_azimuth(azi: Any, radians: bool = False) -> None: ...
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/_transformer.pxd
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include "proj.pxi"
|
| 2 |
+
|
| 3 |
+
from pyproj._crs cimport _CRS, Base
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
cdef class _TransformerGroup:
|
| 7 |
+
cdef PJ_CONTEXT* context
|
| 8 |
+
cdef readonly object _context_manager
|
| 9 |
+
cdef readonly list _transformers
|
| 10 |
+
cdef readonly list _unavailable_operations
|
| 11 |
+
cdef readonly list _best_available
|
| 12 |
+
|
| 13 |
+
cdef class _Transformer(Base):
|
| 14 |
+
cdef PJ_PROJ_INFO proj_info
|
| 15 |
+
cdef readonly _area_of_use
|
| 16 |
+
cdef readonly str type_name
|
| 17 |
+
cdef readonly tuple _operations
|
| 18 |
+
cdef readonly _CRS _source_crs
|
| 19 |
+
cdef readonly _CRS _target_crs
|
| 20 |
+
|
| 21 |
+
@staticmethod
|
| 22 |
+
cdef _Transformer _from_pj(
|
| 23 |
+
PJ_CONTEXT* context,
|
| 24 |
+
PJ *transform_pj,
|
| 25 |
+
bint always_xy,
|
| 26 |
+
)
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/_version.pyi
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PROJ_VERSION: tuple[int, int, int]
|
| 2 |
+
PROJ_VERSION_STR: str
|
| 3 |
+
PROJ_COMPILED_VERSION: tuple[int, int, int]
|
| 4 |
+
PROJ_COMPILED_VERSION_STR: str
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/enums.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This module contains enumerations used in pyproj.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from enum import Enum, IntFlag
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class BaseEnum(Enum):
|
| 9 |
+
"""
|
| 10 |
+
Base enumeration class that handles
|
| 11 |
+
input as strings ignoring case.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
@classmethod
|
| 15 |
+
def create(cls, item):
|
| 16 |
+
"""
|
| 17 |
+
Handles finding the enumeration
|
| 18 |
+
ignoring case if provided as a string.
|
| 19 |
+
"""
|
| 20 |
+
try:
|
| 21 |
+
return cls(item)
|
| 22 |
+
except ValueError:
|
| 23 |
+
pass
|
| 24 |
+
if isinstance(item, str):
|
| 25 |
+
item = item.upper()
|
| 26 |
+
for member in cls:
|
| 27 |
+
if member.value == item:
|
| 28 |
+
return member
|
| 29 |
+
raise ValueError(
|
| 30 |
+
f"Invalid value supplied '{item}'. "
|
| 31 |
+
f"Only {tuple(version.value for version in cls)} are supported."
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class WktVersion(BaseEnum):
|
| 36 |
+
"""
|
| 37 |
+
.. versionadded:: 2.2.0
|
| 38 |
+
|
| 39 |
+
Supported CRS WKT string versions
|
| 40 |
+
|
| 41 |
+
See: :c:enum:`PJ_WKT_TYPE`
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
#: WKT Version 2 from 2015
|
| 45 |
+
WKT2_2015 = "WKT2_2015"
|
| 46 |
+
#: WKT Version 2 from 2015 Simplified
|
| 47 |
+
WKT2_2015_SIMPLIFIED = "WKT2_2015_SIMPLIFIED"
|
| 48 |
+
#: Deprecated alias for WKT Version 2 from 2019
|
| 49 |
+
WKT2_2018 = "WKT2_2018"
|
| 50 |
+
#: Deprecated alias for WKT Version 2 from 2019 Simplified
|
| 51 |
+
WKT2_2018_SIMPLIFIED = "WKT2_2018_SIMPLIFIED"
|
| 52 |
+
#: WKT Version 2 from 2019
|
| 53 |
+
WKT2_2019 = "WKT2_2019"
|
| 54 |
+
#: WKT Version 2 from 2019 Simplified
|
| 55 |
+
WKT2_2019_SIMPLIFIED = "WKT2_2019_SIMPLIFIED"
|
| 56 |
+
#: WKT Version 1 GDAL Style
|
| 57 |
+
WKT1_GDAL = "WKT1_GDAL"
|
| 58 |
+
#: WKT Version 1 ESRI Style
|
| 59 |
+
WKT1_ESRI = "WKT1_ESRI"
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class ProjVersion(BaseEnum):
|
| 63 |
+
"""
|
| 64 |
+
.. versionadded:: 2.2.0
|
| 65 |
+
|
| 66 |
+
Supported CRS PROJ string versions
|
| 67 |
+
"""
|
| 68 |
+
|
| 69 |
+
#: PROJ String version 4
|
| 70 |
+
PROJ_4 = 4
|
| 71 |
+
#: PROJ String version 5
|
| 72 |
+
PROJ_5 = 5
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class TransformDirection(BaseEnum):
|
| 76 |
+
"""
|
| 77 |
+
.. versionadded:: 2.2.0
|
| 78 |
+
|
| 79 |
+
Supported transform directions
|
| 80 |
+
"""
|
| 81 |
+
|
| 82 |
+
#: Forward direction
|
| 83 |
+
FORWARD = "FORWARD"
|
| 84 |
+
#: Inverse direction
|
| 85 |
+
INVERSE = "INVERSE"
|
| 86 |
+
#: Do nothing
|
| 87 |
+
IDENT = "IDENT"
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class PJType(BaseEnum):
|
| 91 |
+
"""
|
| 92 |
+
.. versionadded:: 2.4.0
|
| 93 |
+
|
| 94 |
+
PJ Types for listing codes with :func:`pyproj.get_codes`
|
| 95 |
+
|
| 96 |
+
See: :c:enum:`PJ_TYPE`
|
| 97 |
+
|
| 98 |
+
Attributes
|
| 99 |
+
----------
|
| 100 |
+
UNKNOWN
|
| 101 |
+
ELLIPSOID
|
| 102 |
+
PRIME_MERIDIAN
|
| 103 |
+
GEODETIC_REFERENCE_FRAME
|
| 104 |
+
DYNAMIC_GEODETIC_REFERENCE_FRAME
|
| 105 |
+
VERTICAL_REFERENCE_FRAME
|
| 106 |
+
DYNAMIC_VERTICAL_REFERENCE_FRAME
|
| 107 |
+
DATUM_ENSEMBLE
|
| 108 |
+
CRS
|
| 109 |
+
GEODETIC_CRS
|
| 110 |
+
GEOCENTRIC_CRS
|
| 111 |
+
GEOGRAPHIC_CRS
|
| 112 |
+
GEOGRAPHIC_2D_CRS
|
| 113 |
+
GEOGRAPHIC_3D_CRS
|
| 114 |
+
VERTICAL_CRS
|
| 115 |
+
PROJECTED_CRS
|
| 116 |
+
COMPOUND_CRS
|
| 117 |
+
TEMPORAL_CRS
|
| 118 |
+
ENGINEERING_CRS
|
| 119 |
+
BOUND_CRS
|
| 120 |
+
OTHER_CRS
|
| 121 |
+
CONVERSION
|
| 122 |
+
TRANSFORMATION
|
| 123 |
+
CONCATENATED_OPERATION
|
| 124 |
+
OTHER_COORDINATE_OPERATION
|
| 125 |
+
|
| 126 |
+
"""
|
| 127 |
+
|
| 128 |
+
UNKNOWN = "UNKNOWN"
|
| 129 |
+
ELLIPSOID = "ELLIPSOID"
|
| 130 |
+
PRIME_MERIDIAN = "PRIME_MERIDIAN"
|
| 131 |
+
GEODETIC_REFERENCE_FRAME = "GEODETIC_REFERENCE_FRAME"
|
| 132 |
+
DYNAMIC_GEODETIC_REFERENCE_FRAME = "DYNAMIC_GEODETIC_REFERENCE_FRAME"
|
| 133 |
+
VERTICAL_REFERENCE_FRAME = "VERTICAL_REFERENCE_FRAME"
|
| 134 |
+
DYNAMIC_VERTICAL_REFERENCE_FRAME = "DYNAMIC_VERTICAL_REFERENCE_FRAME"
|
| 135 |
+
DATUM_ENSEMBLE = "DATUM_ENSEMBLE"
|
| 136 |
+
CRS = "CRS"
|
| 137 |
+
GEODETIC_CRS = "GEODETIC_CRS"
|
| 138 |
+
GEOCENTRIC_CRS = "GEOCENTRIC_CRS"
|
| 139 |
+
GEOGRAPHIC_CRS = "GEOGRAPHIC_CRS"
|
| 140 |
+
GEOGRAPHIC_2D_CRS = "GEOGRAPHIC_2D_CRS"
|
| 141 |
+
GEOGRAPHIC_3D_CRS = "GEOGRAPHIC_3D_CRS"
|
| 142 |
+
VERTICAL_CRS = "VERTICAL_CRS"
|
| 143 |
+
PROJECTED_CRS = "PROJECTED_CRS"
|
| 144 |
+
DERIVED_PROJECTED_CRS = "DERIVED_PROJECTED_CRS"
|
| 145 |
+
COMPOUND_CRS = "COMPOUND_CRS"
|
| 146 |
+
TEMPORAL_CRS = "TEMPORAL_CRS"
|
| 147 |
+
ENGINEERING_CRS = "ENGINEERING_CRS"
|
| 148 |
+
BOUND_CRS = "BOUND_CRS"
|
| 149 |
+
OTHER_CRS = "OTHER_CRS"
|
| 150 |
+
CONVERSION = "CONVERSION"
|
| 151 |
+
TRANSFORMATION = "TRANSFORMATION"
|
| 152 |
+
CONCATENATED_OPERATION = "CONCATENATED_OPERATION"
|
| 153 |
+
OTHER_COORDINATE_OPERATION = "OTHER_COORDINATE_OPERATION"
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
class GeodIntermediateFlag(IntFlag):
|
| 157 |
+
"""
|
| 158 |
+
.. versionadded:: 3.1.0
|
| 159 |
+
|
| 160 |
+
Flags to be used in Geod.[inv|fwd]_intermediate()
|
| 161 |
+
"""
|
| 162 |
+
|
| 163 |
+
DEFAULT = 0x0
|
| 164 |
+
|
| 165 |
+
NPTS_ROUND = 0x0
|
| 166 |
+
NPTS_CEIL = 0x1
|
| 167 |
+
NPTS_TRUNC = 0x2
|
| 168 |
+
|
| 169 |
+
DEL_S_RECALC = 0x00
|
| 170 |
+
DEL_S_NO_RECALC = 0x10
|
| 171 |
+
|
| 172 |
+
AZIS_DISCARD = 0x000
|
| 173 |
+
AZIS_KEEP = 0x100
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/list.pyx
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
include "proj.pxi"
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
def get_proj_operations_map():
|
| 5 |
+
"""
|
| 6 |
+
Returns
|
| 7 |
+
-------
|
| 8 |
+
dict:
|
| 9 |
+
Operations supported by PROJ.
|
| 10 |
+
"""
|
| 11 |
+
cdef const PJ_OPERATIONS *proj_operations = proj_list_operations()
|
| 12 |
+
cdef int iii = 0
|
| 13 |
+
operations_map = {}
|
| 14 |
+
while proj_operations[iii].id != NULL:
|
| 15 |
+
operations_map[proj_operations[iii].id] = \
|
| 16 |
+
proj_operations[iii].descr[0].split("\n\t")[0]
|
| 17 |
+
iii += 1
|
| 18 |
+
return operations_map
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def get_ellps_map():
|
| 22 |
+
"""
|
| 23 |
+
Returns
|
| 24 |
+
-------
|
| 25 |
+
dict:
|
| 26 |
+
Ellipsoids supported by PROJ.
|
| 27 |
+
"""
|
| 28 |
+
cdef const PJ_ELLPS *proj_ellps = proj_list_ellps()
|
| 29 |
+
cdef int iii = 0
|
| 30 |
+
ellps_map = {}
|
| 31 |
+
while proj_ellps[iii].id != NULL:
|
| 32 |
+
major_key, major_val = proj_ellps[iii].major.split("=")
|
| 33 |
+
ell_key, ell_val = proj_ellps[iii].ell.split("=")
|
| 34 |
+
ellps_map[proj_ellps[iii].id] = {
|
| 35 |
+
major_key: float(major_val),
|
| 36 |
+
ell_key: float(ell_val),
|
| 37 |
+
"description": proj_ellps[iii].name
|
| 38 |
+
}
|
| 39 |
+
iii += 1
|
| 40 |
+
return ellps_map
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def get_prime_meridians_map():
|
| 44 |
+
"""
|
| 45 |
+
Returns
|
| 46 |
+
-------
|
| 47 |
+
dict:
|
| 48 |
+
Prime Meridians supported by PROJ.
|
| 49 |
+
"""
|
| 50 |
+
cdef const PJ_PRIME_MERIDIANS *prime_meridians = proj_list_prime_meridians()
|
| 51 |
+
cdef int iii = 0
|
| 52 |
+
prime_meridians_map = {}
|
| 53 |
+
while prime_meridians[iii].id != NULL:
|
| 54 |
+
prime_meridians_map[prime_meridians[iii].id] = \
|
| 55 |
+
prime_meridians[iii].defn
|
| 56 |
+
iii += 1
|
| 57 |
+
return prime_meridians_map
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/proj.pxi
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PROJ API Definition
|
| 2 |
+
|
| 3 |
+
cdef extern from "proj.h" nogil:
|
| 4 |
+
cdef int PROJ_VERSION_MAJOR
|
| 5 |
+
cdef int PROJ_VERSION_MINOR
|
| 6 |
+
cdef int PROJ_VERSION_PATCH
|
| 7 |
+
void proj_context_set_search_paths(
|
| 8 |
+
PJ_CONTEXT *ctx, int count_paths, const char* const* paths)
|
| 9 |
+
int proj_context_set_database_path(PJ_CONTEXT *ctx,
|
| 10 |
+
const char *dbPath,
|
| 11 |
+
const char *const *auxDbPaths,
|
| 12 |
+
const char* const *options)
|
| 13 |
+
void proj_context_set_ca_bundle_path(PJ_CONTEXT *ctx, const char *path)
|
| 14 |
+
const char *proj_context_get_database_metadata(PJ_CONTEXT* ctx,
|
| 15 |
+
const char* key)
|
| 16 |
+
ctypedef struct PJ
|
| 17 |
+
ctypedef struct PJ_CONTEXT
|
| 18 |
+
PJ_CONTEXT *proj_context_create ()
|
| 19 |
+
PJ_CONTEXT *proj_context_clone (PJ_CONTEXT *ctx)
|
| 20 |
+
PJ_CONTEXT *proj_context_destroy (PJ_CONTEXT *ctx)
|
| 21 |
+
void proj_assign_context(PJ* pj, PJ_CONTEXT* ctx)
|
| 22 |
+
|
| 23 |
+
ctypedef enum PJ_LOG_LEVEL:
|
| 24 |
+
PJ_LOG_NONE
|
| 25 |
+
PJ_LOG_ERROR
|
| 26 |
+
PJ_LOG_DEBUG
|
| 27 |
+
PJ_LOG_TRACE
|
| 28 |
+
PJ_LOG_TELL
|
| 29 |
+
ctypedef void (*PJ_LOG_FUNCTION)(void *, int, const char *)
|
| 30 |
+
void proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf)
|
| 31 |
+
|
| 32 |
+
int proj_errno (const PJ *P)
|
| 33 |
+
const char * proj_context_errno_string(PJ_CONTEXT* ctx, int err)
|
| 34 |
+
int proj_errno_reset (const PJ *P)
|
| 35 |
+
PJ *proj_create (PJ_CONTEXT *ctx, const char *definition)
|
| 36 |
+
PJ *proj_normalize_for_visualization(PJ_CONTEXT *ctx, const PJ* obj)
|
| 37 |
+
|
| 38 |
+
ctypedef struct PJ_INFO:
|
| 39 |
+
int major # Major release number
|
| 40 |
+
int minor # Minor release number
|
| 41 |
+
int patch # Patch level
|
| 42 |
+
const char *release # Release info. Version + date
|
| 43 |
+
const char *version # Full version number
|
| 44 |
+
const char *searchpath # Paths where init and grid files are
|
| 45 |
+
# looked for. Paths are separated by
|
| 46 |
+
# semi-colons on Windows, and colons
|
| 47 |
+
# on non-Windows platforms.
|
| 48 |
+
const char *const *paths
|
| 49 |
+
size_t path_count
|
| 50 |
+
PJ_INFO proj_info()
|
| 51 |
+
|
| 52 |
+
ctypedef struct PJ_PROJ_INFO:
|
| 53 |
+
const char *id
|
| 54 |
+
const char *description
|
| 55 |
+
const char *definition
|
| 56 |
+
int has_inverse #1 if an inverse mapping exists, 0 otherwise */
|
| 57 |
+
double accuracy
|
| 58 |
+
|
| 59 |
+
PJ_PROJ_INFO proj_pj_info(PJ *P)
|
| 60 |
+
|
| 61 |
+
ctypedef struct PJ_XYZT:
|
| 62 |
+
double x, y, z, t
|
| 63 |
+
ctypedef struct PJ_UVWT:
|
| 64 |
+
double u, v, w, t
|
| 65 |
+
ctypedef struct PJ_LPZT:
|
| 66 |
+
double lam, phi, z, t
|
| 67 |
+
ctypedef struct PJ_OPK:
|
| 68 |
+
double o, p, k
|
| 69 |
+
ctypedef struct PJ_ENU:
|
| 70 |
+
double e, n, u
|
| 71 |
+
ctypedef struct PJ_GEOD:
|
| 72 |
+
double s, a1, a2
|
| 73 |
+
|
| 74 |
+
ctypedef struct PJ_UV:
|
| 75 |
+
double u, v
|
| 76 |
+
ctypedef struct PJ_XY:
|
| 77 |
+
double x, y
|
| 78 |
+
ctypedef struct PJ_LP:
|
| 79 |
+
double lam, phi
|
| 80 |
+
|
| 81 |
+
ctypedef struct PJ_XYZ:
|
| 82 |
+
double x, y, z
|
| 83 |
+
ctypedef struct PJ_UVW:
|
| 84 |
+
double u, v, w
|
| 85 |
+
ctypedef struct PJ_LPZ:
|
| 86 |
+
double lam, phi, z
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
ctypedef union PJ_COORD:
|
| 90 |
+
double v[4];
|
| 91 |
+
PJ_XYZT xyzt;
|
| 92 |
+
PJ_UVWT uvwt;
|
| 93 |
+
PJ_LPZT lpzt;
|
| 94 |
+
PJ_GEOD geod;
|
| 95 |
+
PJ_OPK opk;
|
| 96 |
+
PJ_ENU enu;
|
| 97 |
+
PJ_XYZ xyz;
|
| 98 |
+
PJ_UVW uvw;
|
| 99 |
+
PJ_LPZ lpz;
|
| 100 |
+
PJ_XY xy;
|
| 101 |
+
PJ_UV uv;
|
| 102 |
+
PJ_LP lp;
|
| 103 |
+
|
| 104 |
+
PJ_COORD proj_coord (double x, double y, double z, double t)
|
| 105 |
+
|
| 106 |
+
ctypedef enum PJ_DIRECTION:
|
| 107 |
+
PJ_FWD # Forward
|
| 108 |
+
PJ_IDENT # Do nothing
|
| 109 |
+
PJ_INV # Inverse
|
| 110 |
+
|
| 111 |
+
int proj_angular_input (PJ *P, PJ_DIRECTION dir)
|
| 112 |
+
int proj_angular_output (PJ *P, PJ_DIRECTION dir)
|
| 113 |
+
int proj_degree_input (PJ *P, PJ_DIRECTION dir)
|
| 114 |
+
int proj_degree_output (PJ *P, PJ_DIRECTION dir)
|
| 115 |
+
|
| 116 |
+
PJ_COORD proj_trans (PJ *P, PJ_DIRECTION direction, PJ_COORD coord)
|
| 117 |
+
size_t proj_trans_generic (
|
| 118 |
+
PJ *P,
|
| 119 |
+
PJ_DIRECTION direction,
|
| 120 |
+
double *x, size_t sx, size_t nx,
|
| 121 |
+
double *y, size_t sy, size_t ny,
|
| 122 |
+
double *z, size_t sz, size_t nz,
|
| 123 |
+
double *t, size_t st, size_t nt
|
| 124 |
+
)
|
| 125 |
+
int proj_trans_bounds(
|
| 126 |
+
PJ_CONTEXT* context,
|
| 127 |
+
PJ *P,
|
| 128 |
+
PJ_DIRECTION direction,
|
| 129 |
+
const double xmin,
|
| 130 |
+
const double ymin,
|
| 131 |
+
const double xmax,
|
| 132 |
+
const double ymax,
|
| 133 |
+
double* out_xmin,
|
| 134 |
+
double* out_ymin,
|
| 135 |
+
double* out_xmax,
|
| 136 |
+
double* out_ymax,
|
| 137 |
+
int densify_pts
|
| 138 |
+
)
|
| 139 |
+
PJ* proj_trans_get_last_used_operation(PJ *P)
|
| 140 |
+
ctypedef struct PJ_AREA
|
| 141 |
+
PJ *proj_create_crs_to_crs_from_pj(
|
| 142 |
+
PJ_CONTEXT *ctx,
|
| 143 |
+
PJ *source_crs,
|
| 144 |
+
PJ *target_crs,
|
| 145 |
+
PJ_AREA *area,
|
| 146 |
+
const char* const *options,
|
| 147 |
+
)
|
| 148 |
+
|
| 149 |
+
ctypedef enum PJ_COMPARISON_CRITERION:
|
| 150 |
+
PJ_COMP_STRICT
|
| 151 |
+
PJ_COMP_EQUIVALENT
|
| 152 |
+
PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS
|
| 153 |
+
|
| 154 |
+
void proj_destroy(PJ *obj)
|
| 155 |
+
int proj_is_equivalent_to_with_ctx(PJ_CONTEXT *ctx,
|
| 156 |
+
const PJ *obj, const PJ *other,
|
| 157 |
+
PJ_COMPARISON_CRITERION criterion)
|
| 158 |
+
|
| 159 |
+
const char* proj_get_id_auth_name(const PJ *obj, int index)
|
| 160 |
+
const char* proj_get_id_code(const PJ *obj, int index)
|
| 161 |
+
int proj_get_area_of_use(PJ_CONTEXT *ctx,
|
| 162 |
+
const PJ *obj,
|
| 163 |
+
double* out_west_lon_degree,
|
| 164 |
+
double* out_south_lat_degree,
|
| 165 |
+
double* out_east_lon_degree,
|
| 166 |
+
double* out_north_lat_degree,
|
| 167 |
+
const char **out_area_name)
|
| 168 |
+
PJ_AREA *proj_area_create()
|
| 169 |
+
void proj_area_set_bbox(PJ_AREA *area,
|
| 170 |
+
double west_lon_degree,
|
| 171 |
+
double south_lat_degree,
|
| 172 |
+
double east_lon_degree,
|
| 173 |
+
double north_lat_degree)
|
| 174 |
+
void proj_area_destroy(PJ_AREA* area)
|
| 175 |
+
|
| 176 |
+
ctypedef enum PJ_WKT_TYPE:
|
| 177 |
+
PJ_WKT2_2015
|
| 178 |
+
PJ_WKT2_2015_SIMPLIFIED
|
| 179 |
+
PJ_WKT2_2019
|
| 180 |
+
PJ_WKT2_2019_SIMPLIFIED
|
| 181 |
+
PJ_WKT1_GDAL
|
| 182 |
+
PJ_WKT1_ESRI
|
| 183 |
+
|
| 184 |
+
const char* proj_as_wkt(PJ_CONTEXT *ctx,
|
| 185 |
+
const PJ *obj,
|
| 186 |
+
PJ_WKT_TYPE type,
|
| 187 |
+
const char* const *options)
|
| 188 |
+
|
| 189 |
+
ctypedef enum PJ_PROJ_STRING_TYPE:
|
| 190 |
+
PJ_PROJ_5
|
| 191 |
+
PJ_PROJ_4
|
| 192 |
+
|
| 193 |
+
const char* proj_as_proj_string(PJ_CONTEXT *ctx,
|
| 194 |
+
const PJ *obj,
|
| 195 |
+
PJ_PROJ_STRING_TYPE type,
|
| 196 |
+
const char* const *options)
|
| 197 |
+
const char* proj_as_projjson(PJ_CONTEXT *ctx,
|
| 198 |
+
const PJ *obj,
|
| 199 |
+
const char* const *options)
|
| 200 |
+
PJ *proj_crs_get_geodetic_crs(PJ_CONTEXT *ctx, const PJ *crs)
|
| 201 |
+
|
| 202 |
+
ctypedef enum PJ_TYPE:
|
| 203 |
+
PJ_TYPE_UNKNOWN
|
| 204 |
+
PJ_TYPE_ELLIPSOID
|
| 205 |
+
PJ_TYPE_PRIME_MERIDIAN
|
| 206 |
+
PJ_TYPE_GEODETIC_REFERENCE_FRAME
|
| 207 |
+
PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME
|
| 208 |
+
PJ_TYPE_VERTICAL_REFERENCE_FRAME
|
| 209 |
+
PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME
|
| 210 |
+
PJ_TYPE_DATUM_ENSEMBLE
|
| 211 |
+
PJ_TYPE_CRS
|
| 212 |
+
PJ_TYPE_GEODETIC_CRS
|
| 213 |
+
PJ_TYPE_GEOCENTRIC_CRS
|
| 214 |
+
PJ_TYPE_GEOGRAPHIC_CRS
|
| 215 |
+
PJ_TYPE_GEOGRAPHIC_2D_CRS
|
| 216 |
+
PJ_TYPE_GEOGRAPHIC_3D_CRS
|
| 217 |
+
PJ_TYPE_VERTICAL_CRS
|
| 218 |
+
PJ_TYPE_PROJECTED_CRS
|
| 219 |
+
PJ_TYPE_COMPOUND_CRS
|
| 220 |
+
PJ_TYPE_TEMPORAL_CRS
|
| 221 |
+
PJ_TYPE_ENGINEERING_CRS
|
| 222 |
+
PJ_TYPE_BOUND_CRS
|
| 223 |
+
PJ_TYPE_OTHER_CRS
|
| 224 |
+
PJ_TYPE_CONVERSION
|
| 225 |
+
PJ_TYPE_TRANSFORMATION
|
| 226 |
+
PJ_TYPE_CONCATENATED_OPERATION
|
| 227 |
+
PJ_TYPE_OTHER_COORDINATE_OPERATION
|
| 228 |
+
PJ_TYPE_TEMPORAL_DATUM
|
| 229 |
+
PJ_TYPE_ENGINEERING_DATUM
|
| 230 |
+
PJ_TYPE_PARAMETRIC_DATUM
|
| 231 |
+
PJ_TYPE_DERIVED_PROJECTED_CRS
|
| 232 |
+
|
| 233 |
+
PJ_TYPE proj_get_type(const PJ *obj)
|
| 234 |
+
const char* proj_get_name(const PJ *obj)
|
| 235 |
+
const char* proj_get_remarks(const PJ *obj)
|
| 236 |
+
const char* proj_get_scope(const PJ *obj)
|
| 237 |
+
|
| 238 |
+
int proj_is_crs(const PJ *obj)
|
| 239 |
+
int proj_is_derived_crs(PJ_CONTEXT *ctx, const PJ* crs)
|
| 240 |
+
PJ *proj_crs_get_datum(PJ_CONTEXT *ctx, const PJ *crs)
|
| 241 |
+
PJ *proj_crs_get_horizontal_datum(PJ_CONTEXT *ctx, const PJ *crs)
|
| 242 |
+
|
| 243 |
+
ctypedef enum PJ_COORDINATE_SYSTEM_TYPE:
|
| 244 |
+
PJ_CS_TYPE_UNKNOWN
|
| 245 |
+
PJ_CS_TYPE_CARTESIAN
|
| 246 |
+
PJ_CS_TYPE_ELLIPSOIDAL
|
| 247 |
+
PJ_CS_TYPE_VERTICAL
|
| 248 |
+
PJ_CS_TYPE_SPHERICAL
|
| 249 |
+
PJ_CS_TYPE_ORDINAL
|
| 250 |
+
PJ_CS_TYPE_PARAMETRIC
|
| 251 |
+
PJ_CS_TYPE_DATETIMETEMPORAL
|
| 252 |
+
PJ_CS_TYPE_TEMPORALCOUNT
|
| 253 |
+
PJ_CS_TYPE_TEMPORALMEASURE
|
| 254 |
+
|
| 255 |
+
PJ *proj_crs_get_coordinate_system(PJ_CONTEXT *ctx, const PJ *crs)
|
| 256 |
+
PJ_COORDINATE_SYSTEM_TYPE proj_cs_get_type(PJ_CONTEXT *ctx,
|
| 257 |
+
const PJ *cs)
|
| 258 |
+
int proj_cs_get_axis_count(PJ_CONTEXT *ctx,
|
| 259 |
+
const PJ *cs)
|
| 260 |
+
int proj_cs_get_axis_info(PJ_CONTEXT *ctx,
|
| 261 |
+
const PJ *cs, int index,
|
| 262 |
+
const char **out_name,
|
| 263 |
+
const char **out_abbrev,
|
| 264 |
+
const char **out_direction,
|
| 265 |
+
double *out_unit_conv_factor,
|
| 266 |
+
const char **out_unit_name,
|
| 267 |
+
const char **out_unit_auth_name,
|
| 268 |
+
const char **out_unit_code)
|
| 269 |
+
|
| 270 |
+
PJ *proj_get_ellipsoid(PJ_CONTEXT *ctx, const PJ *obj)
|
| 271 |
+
int proj_ellipsoid_get_parameters(PJ_CONTEXT *ctx,
|
| 272 |
+
const PJ *ellipsoid,
|
| 273 |
+
double *out_semi_major_metre,
|
| 274 |
+
double *out_semi_minor_metre,
|
| 275 |
+
int *out_is_semi_minor_computed,
|
| 276 |
+
double *out_inv_flattening)
|
| 277 |
+
PJ *proj_get_prime_meridian(PJ_CONTEXT *ctx, const PJ *obj)
|
| 278 |
+
int proj_prime_meridian_get_parameters(PJ_CONTEXT *ctx,
|
| 279 |
+
const PJ *prime_meridian,
|
| 280 |
+
double *out_longitude,
|
| 281 |
+
double *out_unit_conv_factor,
|
| 282 |
+
const char **out_unit_name)
|
| 283 |
+
PJ *proj_crs_get_sub_crs(PJ_CONTEXT *ctx, const PJ *crs, int index)
|
| 284 |
+
PJ *proj_get_source_crs(PJ_CONTEXT *ctx, const PJ *obj)
|
| 285 |
+
PJ *proj_get_target_crs(PJ_CONTEXT *ctx, const PJ *obj)
|
| 286 |
+
|
| 287 |
+
ctypedef struct PJ_OBJ_LIST
|
| 288 |
+
PJ_OBJ_LIST *proj_identify(PJ_CONTEXT *ctx,
|
| 289 |
+
const PJ* obj,
|
| 290 |
+
const char *auth_name,
|
| 291 |
+
const char* const *options,
|
| 292 |
+
int **out_confidence)
|
| 293 |
+
PJ *proj_list_get(PJ_CONTEXT *ctx,
|
| 294 |
+
const PJ_OBJ_LIST *result,
|
| 295 |
+
int index)
|
| 296 |
+
int proj_list_get_count(const PJ_OBJ_LIST *result)
|
| 297 |
+
void proj_list_destroy(PJ_OBJ_LIST *result)
|
| 298 |
+
void proj_int_list_destroy(int* list)
|
| 299 |
+
void proj_context_use_proj4_init_rules(PJ_CONTEXT *ctx, int enable)
|
| 300 |
+
ctypedef enum PJ_GUESSED_WKT_DIALECT:
|
| 301 |
+
PJ_GUESSED_WKT2_2018
|
| 302 |
+
PJ_GUESSED_WKT2_2015
|
| 303 |
+
PJ_GUESSED_WKT1_GDAL
|
| 304 |
+
PJ_GUESSED_WKT1_ESRI
|
| 305 |
+
PJ_GUESSED_NOT_WKT
|
| 306 |
+
|
| 307 |
+
PJ_GUESSED_WKT_DIALECT proj_context_guess_wkt_dialect(PJ_CONTEXT *ctx,
|
| 308 |
+
const char *wkt)
|
| 309 |
+
|
| 310 |
+
ctypedef struct PJ_OPERATIONS:
|
| 311 |
+
const char *id
|
| 312 |
+
PJ *(*proj)(PJ *)
|
| 313 |
+
const char * const *descr
|
| 314 |
+
|
| 315 |
+
const PJ_OPERATIONS *proj_list_operations()
|
| 316 |
+
|
| 317 |
+
ctypedef struct PJ_ELLPS:
|
| 318 |
+
const char *id # ellipse keyword name
|
| 319 |
+
const char *major # a= value
|
| 320 |
+
const char *ell # elliptical parameter
|
| 321 |
+
const char *name # comments
|
| 322 |
+
const PJ_ELLPS *proj_list_ellps()
|
| 323 |
+
|
| 324 |
+
ctypedef struct PJ_PRIME_MERIDIANS:
|
| 325 |
+
const char *id
|
| 326 |
+
const char *defn
|
| 327 |
+
const PJ_PRIME_MERIDIANS *proj_list_prime_meridians()
|
| 328 |
+
ctypedef char **PROJ_STRING_LIST
|
| 329 |
+
void proj_string_list_destroy(PROJ_STRING_LIST list)
|
| 330 |
+
PROJ_STRING_LIST proj_get_authorities_from_database(PJ_CONTEXT *ctx)
|
| 331 |
+
PROJ_STRING_LIST proj_get_codes_from_database(PJ_CONTEXT *ctx,
|
| 332 |
+
const char *auth_name,
|
| 333 |
+
PJ_TYPE type,
|
| 334 |
+
int allow_deprecated)
|
| 335 |
+
|
| 336 |
+
ctypedef struct PROJ_CRS_INFO:
|
| 337 |
+
char* auth_name
|
| 338 |
+
char* code
|
| 339 |
+
char* name
|
| 340 |
+
PJ_TYPE type
|
| 341 |
+
int deprecated
|
| 342 |
+
int bbox_valid
|
| 343 |
+
double west_lon_degree
|
| 344 |
+
double south_lat_degree
|
| 345 |
+
double east_lon_degree
|
| 346 |
+
double north_lat_degree
|
| 347 |
+
char* area_name
|
| 348 |
+
char* projection_method_name
|
| 349 |
+
|
| 350 |
+
ctypedef struct PROJ_CRS_LIST_PARAMETERS:
|
| 351 |
+
const PJ_TYPE* types
|
| 352 |
+
size_t typesCount
|
| 353 |
+
int crs_area_of_use_contains_bbox
|
| 354 |
+
int bbox_valid
|
| 355 |
+
double west_lon_degree
|
| 356 |
+
double south_lat_degree
|
| 357 |
+
double east_lon_degree
|
| 358 |
+
double north_lat_degree
|
| 359 |
+
int allow_deprecated
|
| 360 |
+
|
| 361 |
+
PROJ_CRS_LIST_PARAMETERS *proj_get_crs_list_parameters_create()
|
| 362 |
+
|
| 363 |
+
void proj_get_crs_list_parameters_destroy(PROJ_CRS_LIST_PARAMETERS* params)
|
| 364 |
+
|
| 365 |
+
PROJ_CRS_INFO **proj_get_crs_info_list_from_database(
|
| 366 |
+
PJ_CONTEXT *ctx,
|
| 367 |
+
const char *auth_name,
|
| 368 |
+
const PROJ_CRS_LIST_PARAMETERS* params,
|
| 369 |
+
int *out_result_count)
|
| 370 |
+
|
| 371 |
+
void proj_crs_info_list_destroy(PROJ_CRS_INFO** list)
|
| 372 |
+
|
| 373 |
+
PJ *proj_crs_get_coordoperation(PJ_CONTEXT *ctx,
|
| 374 |
+
const PJ *crs)
|
| 375 |
+
|
| 376 |
+
int proj_coordoperation_get_method_info(PJ_CONTEXT *ctx,
|
| 377 |
+
const PJ *coordoperation,
|
| 378 |
+
const char **out_method_name,
|
| 379 |
+
const char **out_method_auth_name,
|
| 380 |
+
const char **out_method_code)
|
| 381 |
+
|
| 382 |
+
int proj_coordoperation_is_instantiable(PJ_CONTEXT *ctx,
|
| 383 |
+
const PJ *coordoperation)
|
| 384 |
+
|
| 385 |
+
int proj_coordoperation_has_ballpark_transformation(PJ_CONTEXT *ctx,
|
| 386 |
+
const PJ *coordoperation)
|
| 387 |
+
|
| 388 |
+
int proj_coordoperation_get_param_count(PJ_CONTEXT *ctx,
|
| 389 |
+
const PJ *coordoperation)
|
| 390 |
+
|
| 391 |
+
int proj_coordoperation_get_param_index(PJ_CONTEXT *ctx,
|
| 392 |
+
const PJ *coordoperation,
|
| 393 |
+
const char *name)
|
| 394 |
+
|
| 395 |
+
int proj_coordoperation_get_param(PJ_CONTEXT *ctx,
|
| 396 |
+
const PJ *coordoperation,
|
| 397 |
+
int index,
|
| 398 |
+
const char **out_name,
|
| 399 |
+
const char **out_auth_name,
|
| 400 |
+
const char **out_code,
|
| 401 |
+
double *out_value,
|
| 402 |
+
const char **out_value_string,
|
| 403 |
+
double *out_unit_conv_factor,
|
| 404 |
+
const char **out_unit_name,
|
| 405 |
+
const char **out_unit_auth_name,
|
| 406 |
+
const char **out_unit_code,
|
| 407 |
+
const char **out_unit_category)
|
| 408 |
+
|
| 409 |
+
int proj_coordoperation_get_grid_used_count(PJ_CONTEXT *ctx,
|
| 410 |
+
const PJ *coordoperation)
|
| 411 |
+
|
| 412 |
+
int proj_coordoperation_get_grid_used(PJ_CONTEXT *ctx,
|
| 413 |
+
const PJ *coordoperation,
|
| 414 |
+
int index,
|
| 415 |
+
const char **out_short_name,
|
| 416 |
+
const char **out_full_name,
|
| 417 |
+
const char **out_package_name,
|
| 418 |
+
const char **out_url,
|
| 419 |
+
int *out_direct_download,
|
| 420 |
+
int *out_open_license,
|
| 421 |
+
int *out_available)
|
| 422 |
+
|
| 423 |
+
double proj_coordoperation_get_accuracy(PJ_CONTEXT *ctx,
|
| 424 |
+
const PJ *obj)
|
| 425 |
+
|
| 426 |
+
int proj_coordoperation_get_towgs84_values(PJ_CONTEXT *ctx,
|
| 427 |
+
const PJ *coordoperation,
|
| 428 |
+
double *out_values,
|
| 429 |
+
int value_count,
|
| 430 |
+
int emit_error_if_incompatible)
|
| 431 |
+
int proj_concatoperation_get_step_count(PJ_CONTEXT *ctx,
|
| 432 |
+
const PJ *concatoperation)
|
| 433 |
+
PJ *proj_concatoperation_get_step(PJ_CONTEXT *ctx,
|
| 434 |
+
const PJ *concatoperation,
|
| 435 |
+
int i_step)
|
| 436 |
+
ctypedef enum PJ_CATEGORY:
|
| 437 |
+
PJ_CATEGORY_ELLIPSOID
|
| 438 |
+
PJ_CATEGORY_PRIME_MERIDIAN
|
| 439 |
+
PJ_CATEGORY_DATUM
|
| 440 |
+
PJ_CATEGORY_CRS
|
| 441 |
+
PJ_CATEGORY_COORDINATE_OPERATION
|
| 442 |
+
PJ_CATEGORY_DATUM_ENSEMBLE
|
| 443 |
+
PJ *proj_create_from_database(PJ_CONTEXT *ctx,
|
| 444 |
+
const char *auth_name,
|
| 445 |
+
const char *code,
|
| 446 |
+
PJ_CATEGORY category,
|
| 447 |
+
int usePROJAlternativeGridNames,
|
| 448 |
+
const char* const *options)
|
| 449 |
+
PJ_OBJ_LIST *proj_create_from_name(PJ_CONTEXT *ctx,
|
| 450 |
+
const char *auth_name,
|
| 451 |
+
const char *searchedName,
|
| 452 |
+
const PJ_TYPE* types,
|
| 453 |
+
size_t typesCount,
|
| 454 |
+
int approximateMatch,
|
| 455 |
+
size_t limitResultCount,
|
| 456 |
+
const char* const *options)
|
| 457 |
+
|
| 458 |
+
ctypedef struct PJ_OPERATION_FACTORY_CONTEXT
|
| 459 |
+
|
| 460 |
+
PJ_OPERATION_FACTORY_CONTEXT *proj_create_operation_factory_context(
|
| 461 |
+
PJ_CONTEXT *ctx,
|
| 462 |
+
const char *authority
|
| 463 |
+
)
|
| 464 |
+
void proj_operation_factory_context_destroy(
|
| 465 |
+
PJ_OPERATION_FACTORY_CONTEXT *ctx
|
| 466 |
+
)
|
| 467 |
+
PJ_OBJ_LIST *proj_create_operations(
|
| 468 |
+
PJ_CONTEXT *ctx,
|
| 469 |
+
const PJ *source_crs,
|
| 470 |
+
const PJ *target_crs,
|
| 471 |
+
const PJ_OPERATION_FACTORY_CONTEXT *operationContext
|
| 472 |
+
)
|
| 473 |
+
void proj_operation_factory_context_set_grid_availability_use(
|
| 474 |
+
PJ_CONTEXT *ctx,
|
| 475 |
+
PJ_OPERATION_FACTORY_CONTEXT *factory_ctx,
|
| 476 |
+
PROJ_GRID_AVAILABILITY_USE use
|
| 477 |
+
)
|
| 478 |
+
void proj_operation_factory_context_set_spatial_criterion(
|
| 479 |
+
PJ_CONTEXT *ctx,
|
| 480 |
+
PJ_OPERATION_FACTORY_CONTEXT *factory_ctx,
|
| 481 |
+
PROJ_SPATIAL_CRITERION criterion
|
| 482 |
+
)
|
| 483 |
+
void proj_operation_factory_context_set_area_of_interest(
|
| 484 |
+
PJ_CONTEXT *ctx,
|
| 485 |
+
PJ_OPERATION_FACTORY_CONTEXT *factory_ctx,
|
| 486 |
+
double west_lon_degree,
|
| 487 |
+
double south_lat_degree,
|
| 488 |
+
double east_lon_degree,
|
| 489 |
+
double north_lat_degree
|
| 490 |
+
)
|
| 491 |
+
void proj_operation_factory_context_set_allow_ballpark_transformations(
|
| 492 |
+
PJ_CONTEXT *ctx,
|
| 493 |
+
PJ_OPERATION_FACTORY_CONTEXT *factory_ctx,
|
| 494 |
+
int allow
|
| 495 |
+
)
|
| 496 |
+
void proj_operation_factory_context_set_discard_superseded(
|
| 497 |
+
PJ_CONTEXT *ctx,
|
| 498 |
+
PJ_OPERATION_FACTORY_CONTEXT *factory_ctx,
|
| 499 |
+
int discard
|
| 500 |
+
)
|
| 501 |
+
void proj_operation_factory_context_set_desired_accuracy(
|
| 502 |
+
PJ_CONTEXT *ctx,
|
| 503 |
+
PJ_OPERATION_FACTORY_CONTEXT *factory_ctx,
|
| 504 |
+
double accuracy
|
| 505 |
+
)
|
| 506 |
+
ctypedef enum PROJ_SPATIAL_CRITERION:
|
| 507 |
+
PROJ_SPATIAL_CRITERION_STRICT_CONTAINMENT
|
| 508 |
+
PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION
|
| 509 |
+
|
| 510 |
+
ctypedef enum PROJ_GRID_AVAILABILITY_USE:
|
| 511 |
+
PROJ_GRID_AVAILABILITY_USED_FOR_SORTING
|
| 512 |
+
PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID
|
| 513 |
+
PROJ_GRID_AVAILABILITY_IGNORED
|
| 514 |
+
PROJ_GRID_AVAILABILITY_KNOWN_AVAILABLE
|
| 515 |
+
|
| 516 |
+
ctypedef struct PJ_FACTORS:
|
| 517 |
+
double meridional_scale
|
| 518 |
+
double parallel_scale
|
| 519 |
+
double areal_scale
|
| 520 |
+
double angular_distortion
|
| 521 |
+
double meridian_parallel_angle
|
| 522 |
+
double meridian_convergence
|
| 523 |
+
double tissot_semimajor
|
| 524 |
+
double tissot_semiminor
|
| 525 |
+
double dx_dlam
|
| 526 |
+
double dx_dphi
|
| 527 |
+
double dy_dlam
|
| 528 |
+
double dy_dphi
|
| 529 |
+
|
| 530 |
+
PJ_FACTORS proj_factors(PJ *P, PJ_COORD lp)
|
| 531 |
+
# neworking related
|
| 532 |
+
const char *proj_context_get_user_writable_directory(PJ_CONTEXT *ctx, int create)
|
| 533 |
+
int proj_context_set_enable_network(PJ_CONTEXT* ctx, int enabled)
|
| 534 |
+
int proj_context_is_network_enabled(PJ_CONTEXT* ctx)
|
| 535 |
+
# units
|
| 536 |
+
ctypedef struct PROJ_UNIT_INFO:
|
| 537 |
+
# Authority name.
|
| 538 |
+
char* auth_name
|
| 539 |
+
# Object code.
|
| 540 |
+
char* code
|
| 541 |
+
# Object name. For example "metre", "US survey foot", etc. */
|
| 542 |
+
char* name
|
| 543 |
+
# Category of the unit: one of "linear", "linear_per_time", "angular",
|
| 544 |
+
# "angular_per_time", "scale", "scale_per_time" or "time" */
|
| 545 |
+
char* category
|
| 546 |
+
# Conversion factor to apply to transform from that unit to the
|
| 547 |
+
# corresponding SI unit (metre for "linear", radian for "angular", etc.).
|
| 548 |
+
# It might be 0 in some cases to indicate no known conversion factor.
|
| 549 |
+
double conv_factor
|
| 550 |
+
# PROJ short name, like "m", "ft", "us-ft", etc... Might be NULL */
|
| 551 |
+
char* proj_short_name
|
| 552 |
+
# Whether the object is deprecated
|
| 553 |
+
int deprecated
|
| 554 |
+
|
| 555 |
+
PROJ_UNIT_INFO **proj_get_units_from_database(
|
| 556 |
+
PJ_CONTEXT *ctx,
|
| 557 |
+
const char *auth_name,
|
| 558 |
+
const char *category,
|
| 559 |
+
int allow_deprecated,
|
| 560 |
+
int *out_result_count,
|
| 561 |
+
)
|
| 562 |
+
void proj_unit_list_destroy(PROJ_UNIT_INFO** list)
|
| 563 |
+
const char *proj_context_get_url_endpoint(PJ_CONTEXT* ctx)
|
| 564 |
+
|
| 565 |
+
int proj_is_deprecated(const PJ *obj)
|
| 566 |
+
PJ_OBJ_LIST *proj_get_non_deprecated(PJ_CONTEXT *ctx, const PJ *obj)
|
CasualLab/.venv/lib/python3.12/site-packages/pyproj/sync.py
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Based on the logic in the PROJ projsync CLI program
|
| 3 |
+
|
| 4 |
+
https://github.com/OSGeo/PROJ/blob/9ff543c4ffd86152bc58d0a0164b2ce9ebbb8bec/src/apps/projsync.cpp
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import hashlib
|
| 8 |
+
import json
|
| 9 |
+
import os
|
| 10 |
+
from datetime import datetime
|
| 11 |
+
from functools import partial
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
from typing import Any
|
| 14 |
+
from urllib.request import urlretrieve
|
| 15 |
+
|
| 16 |
+
from pyproj._sync import get_proj_endpoint
|
| 17 |
+
from pyproj.aoi import BBox
|
| 18 |
+
from pyproj.datadir import get_data_dir, get_user_data_dir
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def _bbox_from_coords(coords: list) -> BBox | None:
|
| 22 |
+
"""
|
| 23 |
+
Get the bounding box from coordinates
|
| 24 |
+
"""
|
| 25 |
+
try:
|
| 26 |
+
xxx, yyy = zip(*coords)
|
| 27 |
+
return BBox(west=min(xxx), south=min(yyy), east=max(xxx), north=max(yyy))
|
| 28 |
+
except ValueError:
|
| 29 |
+
pass
|
| 30 |
+
coord_bbox = None
|
| 31 |
+
for coord_set in coords:
|
| 32 |
+
bbox = _bbox_from_coords(coord_set)
|
| 33 |
+
if bbox is None:
|
| 34 |
+
continue
|
| 35 |
+
if coord_bbox is None:
|
| 36 |
+
coord_bbox = bbox
|
| 37 |
+
else:
|
| 38 |
+
coord_bbox.west = min(coord_bbox.west, bbox.west)
|
| 39 |
+
coord_bbox.south = min(coord_bbox.south, bbox.south)
|
| 40 |
+
coord_bbox.north = max(coord_bbox.north, bbox.north)
|
| 41 |
+
coord_bbox.east = max(coord_bbox.east, bbox.east)
|
| 42 |
+
return coord_bbox
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _bbox_from_geom(geom: dict[str, Any]) -> BBox | None:
|
| 46 |
+
"""
|
| 47 |
+
Get the bounding box from geojson geometry
|
| 48 |
+
"""
|
| 49 |
+
if "coordinates" not in geom or "type" not in geom:
|
| 50 |
+
return None
|
| 51 |
+
coordinates = geom["coordinates"]
|
| 52 |
+
if geom["type"] != "MultiPolygon":
|
| 53 |
+
return _bbox_from_coords(coordinates)
|
| 54 |
+
found_minus_180 = False
|
| 55 |
+
found_plus_180 = False
|
| 56 |
+
bboxes = []
|
| 57 |
+
for coordinate_set in coordinates:
|
| 58 |
+
bbox = _bbox_from_coords(coordinate_set)
|
| 59 |
+
if bbox is None:
|
| 60 |
+
continue
|
| 61 |
+
if bbox.west == -180:
|
| 62 |
+
found_minus_180 = True
|
| 63 |
+
elif bbox.east == 180:
|
| 64 |
+
found_plus_180 = True
|
| 65 |
+
bboxes.append(bbox)
|
| 66 |
+
grid_bbox = None
|
| 67 |
+
for bbox in bboxes:
|
| 68 |
+
if found_minus_180 and found_plus_180 and bbox.west == -180:
|
| 69 |
+
bbox.west = 180
|
| 70 |
+
bbox.east += 360
|
| 71 |
+
if grid_bbox is None:
|
| 72 |
+
grid_bbox = bbox
|
| 73 |
+
else:
|
| 74 |
+
grid_bbox.west = min(grid_bbox.west, bbox.west)
|
| 75 |
+
grid_bbox.south = min(grid_bbox.south, bbox.south)
|
| 76 |
+
grid_bbox.north = max(grid_bbox.north, bbox.north)
|
| 77 |
+
grid_bbox.east = max(grid_bbox.east, bbox.east)
|
| 78 |
+
return grid_bbox
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def _filter_bbox(
|
| 82 |
+
feature: dict[str, Any], bbox: BBox, spatial_test: str, include_world_coverage: bool
|
| 83 |
+
) -> bool:
|
| 84 |
+
"""
|
| 85 |
+
Filter by the bounding box. Designed to use with 'filter'
|
| 86 |
+
"""
|
| 87 |
+
geom = feature.get("geometry")
|
| 88 |
+
if geom is not None:
|
| 89 |
+
geom_bbox = _bbox_from_geom(geom)
|
| 90 |
+
if geom_bbox is None:
|
| 91 |
+
return False
|
| 92 |
+
if (
|
| 93 |
+
geom_bbox.east - geom_bbox.west > 359
|
| 94 |
+
and geom_bbox.north - geom_bbox.south > 179
|
| 95 |
+
):
|
| 96 |
+
if not include_world_coverage:
|
| 97 |
+
return False
|
| 98 |
+
geom_bbox.west = -float("inf")
|
| 99 |
+
geom_bbox.east = float("inf")
|
| 100 |
+
elif geom_bbox.east > 180 and bbox.west < -180:
|
| 101 |
+
geom_bbox.west -= 360
|
| 102 |
+
geom_bbox.east -= 360
|
| 103 |
+
return getattr(bbox, spatial_test)(geom_bbox)
|
| 104 |
+
return False
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def _filter_properties(
|
| 108 |
+
feature: dict[str, Any],
|
| 109 |
+
source_id: str | None = None,
|
| 110 |
+
area_of_use: str | None = None,
|
| 111 |
+
filename: str | None = None,
|
| 112 |
+
) -> bool:
|
| 113 |
+
"""
|
| 114 |
+
Filter by the properties. Designed to use with 'filter'
|
| 115 |
+
"""
|
| 116 |
+
properties = feature.get("properties")
|
| 117 |
+
if not properties:
|
| 118 |
+
return False
|
| 119 |
+
p_filename = properties.get("name")
|
| 120 |
+
p_source_id = properties.get("source_id")
|
| 121 |
+
if not p_filename or not p_source_id:
|
| 122 |
+
return False
|
| 123 |
+
source_id__matched = source_id is None or source_id in p_source_id
|
| 124 |
+
area_of_use__matched = area_of_use is None or area_of_use in properties.get(
|
| 125 |
+
"area_of_use", ""
|
| 126 |
+
)
|
| 127 |
+
filename__matched = filename is None or filename in p_filename
|
| 128 |
+
if source_id__matched and area_of_use__matched and filename__matched:
|
| 129 |
+
return True
|
| 130 |
+
return False
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def _is_download_needed(grid_name: str) -> bool:
|
| 134 |
+
"""
|
| 135 |
+
Run through all of the PROJ directories to see if the
|
| 136 |
+
file already exists.
|
| 137 |
+
"""
|
| 138 |
+
if Path(get_user_data_dir(), grid_name).exists():
|
| 139 |
+
return False
|
| 140 |
+
for data_dir in get_data_dir().split(os.pathsep):
|
| 141 |
+
if Path(data_dir, grid_name).exists():
|
| 142 |
+
return False
|
| 143 |
+
return True
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def _filter_download_needed(feature: dict[str, Any]) -> bool:
|
| 147 |
+
"""
|
| 148 |
+
Filter grids so only those that need to be downloaded are included.
|
| 149 |
+
"""
|
| 150 |
+
properties = feature.get("properties")
|
| 151 |
+
if not properties:
|
| 152 |
+
return False
|
| 153 |
+
filename = properties.get("name")
|
| 154 |
+
if not filename:
|
| 155 |
+
return False
|
| 156 |
+
return _is_download_needed(filename)
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def _sha256sum(input_file):
|
| 160 |
+
"""
|
| 161 |
+
Return sha256 checksum of file given by path.
|
| 162 |
+
"""
|
| 163 |
+
|
| 164 |
+
hasher = hashlib.sha256()
|
| 165 |
+
with open(input_file, "rb") as file:
|
| 166 |
+
for chunk in iter(lambda: file.read(65536), b""):
|
| 167 |
+
hasher.update(chunk)
|
| 168 |
+
|
| 169 |
+
return hasher.hexdigest()
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def _download_resource_file(
|
| 173 |
+
file_url, short_name, directory, verbose=False, sha256=None
|
| 174 |
+
):
|
| 175 |
+
"""
|
| 176 |
+
Download resource file from PROJ url
|
| 177 |
+
"""
|
| 178 |
+
if verbose:
|
| 179 |
+
print(f"Downloading: {file_url}")
|
| 180 |
+
tmp_path = Path(directory, f"{short_name}.part")
|
| 181 |
+
try:
|
| 182 |
+
urlretrieve(file_url, tmp_path)
|
| 183 |
+
if sha256 is not None and sha256 != _sha256sum(tmp_path):
|
| 184 |
+
raise RuntimeError(f"SHA256 mismatch: {short_name}")
|
| 185 |
+
tmp_path.replace(Path(directory, short_name))
|
| 186 |
+
finally:
|
| 187 |
+
try:
|
| 188 |
+
os.remove(tmp_path)
|
| 189 |
+
except FileNotFoundError:
|
| 190 |
+
pass
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def _load_grid_geojson(target_directory: str | Path | None = None) -> dict[str, Any]:
|
| 194 |
+
"""
|
| 195 |
+
Returns
|
| 196 |
+
-------
|
| 197 |
+
dict[str, Any]:
|
| 198 |
+
The PROJ grid data list.
|
| 199 |
+
"""
|
| 200 |
+
if target_directory is None:
|
| 201 |
+
target_directory = get_user_data_dir(True)
|
| 202 |
+
local_path = Path(target_directory, "files.geojson")
|
| 203 |
+
if not local_path.exists() or (
|
| 204 |
+
(datetime.now() - datetime.fromtimestamp(local_path.stat().st_mtime)).days > 0
|
| 205 |
+
):
|
| 206 |
+
_download_resource_file(
|
| 207 |
+
file_url=f"{get_proj_endpoint()}/files.geojson",
|
| 208 |
+
short_name="files.geojson",
|
| 209 |
+
directory=target_directory,
|
| 210 |
+
)
|
| 211 |
+
return json.loads(local_path.read_text(encoding="utf-8"))
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
def get_transform_grid_list(
|
| 215 |
+
source_id: str | None = None,
|
| 216 |
+
area_of_use: str | None = None,
|
| 217 |
+
filename: str | None = None,
|
| 218 |
+
bbox: BBox | None = None,
|
| 219 |
+
spatial_test: str = "intersects",
|
| 220 |
+
include_world_coverage: bool = True,
|
| 221 |
+
include_already_downloaded: bool = False,
|
| 222 |
+
target_directory: str | Path | None = None,
|
| 223 |
+
) -> tuple:
|
| 224 |
+
"""
|
| 225 |
+
Get a list of transform grids that can be downloaded.
|
| 226 |
+
|
| 227 |
+
Parameters
|
| 228 |
+
----------
|
| 229 |
+
source_id: str, optional
|
| 230 |
+
area_of_use: str, optional
|
| 231 |
+
filename: str, optional
|
| 232 |
+
bbox: BBox, optional
|
| 233 |
+
spatial_test: str, default="intersects"
|
| 234 |
+
Can be "contains" or "intersects".
|
| 235 |
+
include_world_coverage: bool, default=True
|
| 236 |
+
If True, it will include grids with a global extent.
|
| 237 |
+
include_already_downloaded: bool, default=False
|
| 238 |
+
If True, it will list grids regardless of if they are downloaded.
|
| 239 |
+
target_directory: str | Path, optional
|
| 240 |
+
The directory to download the geojson file to.
|
| 241 |
+
Default is the user writable directory.
|
| 242 |
+
|
| 243 |
+
Returns
|
| 244 |
+
-------
|
| 245 |
+
list[dict[str, Any]]:
|
| 246 |
+
A list of geojson data of containing information about features
|
| 247 |
+
that can be downloaded.
|
| 248 |
+
"""
|
| 249 |
+
features = _load_grid_geojson(target_directory=target_directory)["features"]
|
| 250 |
+
if bbox is not None:
|
| 251 |
+
if bbox.west > 180 and bbox.east > bbox.west:
|
| 252 |
+
bbox.west -= 360
|
| 253 |
+
bbox.east -= 360
|
| 254 |
+
elif bbox.west < -180 and bbox.east > bbox.west:
|
| 255 |
+
bbox.west += 360
|
| 256 |
+
bbox.east += 360
|
| 257 |
+
elif abs(bbox.west) < 180 and abs(bbox.east) < 180 and bbox.east < bbox.west:
|
| 258 |
+
bbox.east += 360
|
| 259 |
+
features = filter(
|
| 260 |
+
partial(
|
| 261 |
+
_filter_bbox,
|
| 262 |
+
bbox=bbox,
|
| 263 |
+
spatial_test=spatial_test,
|
| 264 |
+
include_world_coverage=include_world_coverage,
|
| 265 |
+
),
|
| 266 |
+
features,
|
| 267 |
+
)
|
| 268 |
+
# filter by properties
|
| 269 |
+
features = filter(
|
| 270 |
+
partial(
|
| 271 |
+
_filter_properties,
|
| 272 |
+
source_id=source_id,
|
| 273 |
+
area_of_use=area_of_use,
|
| 274 |
+
filename=filename,
|
| 275 |
+
),
|
| 276 |
+
features,
|
| 277 |
+
)
|
| 278 |
+
if include_already_downloaded:
|
| 279 |
+
return tuple(features)
|
| 280 |
+
return tuple(filter(_filter_download_needed, features))
|
CasualLab/.venv/lib/python3.12/site-packages/shapefile.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CasualLab/.venv/lib/python3.12/site-packages/six.py
ADDED
|
@@ -0,0 +1,1003 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2010-2024 Benjamin Peterson
|
| 2 |
+
#
|
| 3 |
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 4 |
+
# of this software and associated documentation files (the "Software"), to deal
|
| 5 |
+
# in the Software without restriction, including without limitation the rights
|
| 6 |
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 7 |
+
# copies of the Software, and to permit persons to whom the Software is
|
| 8 |
+
# furnished to do so, subject to the following conditions:
|
| 9 |
+
#
|
| 10 |
+
# The above copyright notice and this permission notice shall be included in all
|
| 11 |
+
# copies or substantial portions of the Software.
|
| 12 |
+
#
|
| 13 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 14 |
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 15 |
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 16 |
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 17 |
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 18 |
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 19 |
+
# SOFTWARE.
|
| 20 |
+
|
| 21 |
+
"""Utilities for writing code that runs on Python 2 and 3"""
|
| 22 |
+
|
| 23 |
+
from __future__ import absolute_import
|
| 24 |
+
|
| 25 |
+
import functools
|
| 26 |
+
import itertools
|
| 27 |
+
import operator
|
| 28 |
+
import sys
|
| 29 |
+
import types
|
| 30 |
+
|
| 31 |
+
__author__ = "Benjamin Peterson <benjamin@python.org>"
|
| 32 |
+
__version__ = "1.17.0"
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
# Useful for very coarse version differentiation.
|
| 36 |
+
PY2 = sys.version_info[0] == 2
|
| 37 |
+
PY3 = sys.version_info[0] == 3
|
| 38 |
+
PY34 = sys.version_info[0:2] >= (3, 4)
|
| 39 |
+
|
| 40 |
+
if PY3:
|
| 41 |
+
string_types = str,
|
| 42 |
+
integer_types = int,
|
| 43 |
+
class_types = type,
|
| 44 |
+
text_type = str
|
| 45 |
+
binary_type = bytes
|
| 46 |
+
|
| 47 |
+
MAXSIZE = sys.maxsize
|
| 48 |
+
else:
|
| 49 |
+
string_types = basestring,
|
| 50 |
+
integer_types = (int, long)
|
| 51 |
+
class_types = (type, types.ClassType)
|
| 52 |
+
text_type = unicode
|
| 53 |
+
binary_type = str
|
| 54 |
+
|
| 55 |
+
if sys.platform.startswith("java"):
|
| 56 |
+
# Jython always uses 32 bits.
|
| 57 |
+
MAXSIZE = int((1 << 31) - 1)
|
| 58 |
+
else:
|
| 59 |
+
# It's possible to have sizeof(long) != sizeof(Py_ssize_t).
|
| 60 |
+
class X(object):
|
| 61 |
+
|
| 62 |
+
def __len__(self):
|
| 63 |
+
return 1 << 31
|
| 64 |
+
try:
|
| 65 |
+
len(X())
|
| 66 |
+
except OverflowError:
|
| 67 |
+
# 32-bit
|
| 68 |
+
MAXSIZE = int((1 << 31) - 1)
|
| 69 |
+
else:
|
| 70 |
+
# 64-bit
|
| 71 |
+
MAXSIZE = int((1 << 63) - 1)
|
| 72 |
+
del X
|
| 73 |
+
|
| 74 |
+
if PY34:
|
| 75 |
+
from importlib.util import spec_from_loader
|
| 76 |
+
else:
|
| 77 |
+
spec_from_loader = None
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def _add_doc(func, doc):
|
| 81 |
+
"""Add documentation to a function."""
|
| 82 |
+
func.__doc__ = doc
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def _import_module(name):
|
| 86 |
+
"""Import module, returning the module after the last dot."""
|
| 87 |
+
__import__(name)
|
| 88 |
+
return sys.modules[name]
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
class _LazyDescr(object):
|
| 92 |
+
|
| 93 |
+
def __init__(self, name):
|
| 94 |
+
self.name = name
|
| 95 |
+
|
| 96 |
+
def __get__(self, obj, tp):
|
| 97 |
+
result = self._resolve()
|
| 98 |
+
setattr(obj, self.name, result) # Invokes __set__.
|
| 99 |
+
try:
|
| 100 |
+
# This is a bit ugly, but it avoids running this again by
|
| 101 |
+
# removing this descriptor.
|
| 102 |
+
delattr(obj.__class__, self.name)
|
| 103 |
+
except AttributeError:
|
| 104 |
+
pass
|
| 105 |
+
return result
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class MovedModule(_LazyDescr):
|
| 109 |
+
|
| 110 |
+
def __init__(self, name, old, new=None):
|
| 111 |
+
super(MovedModule, self).__init__(name)
|
| 112 |
+
if PY3:
|
| 113 |
+
if new is None:
|
| 114 |
+
new = name
|
| 115 |
+
self.mod = new
|
| 116 |
+
else:
|
| 117 |
+
self.mod = old
|
| 118 |
+
|
| 119 |
+
def _resolve(self):
|
| 120 |
+
return _import_module(self.mod)
|
| 121 |
+
|
| 122 |
+
def __getattr__(self, attr):
|
| 123 |
+
_module = self._resolve()
|
| 124 |
+
value = getattr(_module, attr)
|
| 125 |
+
setattr(self, attr, value)
|
| 126 |
+
return value
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class _LazyModule(types.ModuleType):
|
| 130 |
+
|
| 131 |
+
def __init__(self, name):
|
| 132 |
+
super(_LazyModule, self).__init__(name)
|
| 133 |
+
self.__doc__ = self.__class__.__doc__
|
| 134 |
+
|
| 135 |
+
def __dir__(self):
|
| 136 |
+
attrs = ["__doc__", "__name__"]
|
| 137 |
+
attrs += [attr.name for attr in self._moved_attributes]
|
| 138 |
+
return attrs
|
| 139 |
+
|
| 140 |
+
# Subclasses should override this
|
| 141 |
+
_moved_attributes = []
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class MovedAttribute(_LazyDescr):
|
| 145 |
+
|
| 146 |
+
def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
|
| 147 |
+
super(MovedAttribute, self).__init__(name)
|
| 148 |
+
if PY3:
|
| 149 |
+
if new_mod is None:
|
| 150 |
+
new_mod = name
|
| 151 |
+
self.mod = new_mod
|
| 152 |
+
if new_attr is None:
|
| 153 |
+
if old_attr is None:
|
| 154 |
+
new_attr = name
|
| 155 |
+
else:
|
| 156 |
+
new_attr = old_attr
|
| 157 |
+
self.attr = new_attr
|
| 158 |
+
else:
|
| 159 |
+
self.mod = old_mod
|
| 160 |
+
if old_attr is None:
|
| 161 |
+
old_attr = name
|
| 162 |
+
self.attr = old_attr
|
| 163 |
+
|
| 164 |
+
def _resolve(self):
|
| 165 |
+
module = _import_module(self.mod)
|
| 166 |
+
return getattr(module, self.attr)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class _SixMetaPathImporter(object):
|
| 170 |
+
|
| 171 |
+
"""
|
| 172 |
+
A meta path importer to import six.moves and its submodules.
|
| 173 |
+
|
| 174 |
+
This class implements a PEP302 finder and loader. It should be compatible
|
| 175 |
+
with Python 2.5 and all existing versions of Python3
|
| 176 |
+
"""
|
| 177 |
+
|
| 178 |
+
def __init__(self, six_module_name):
|
| 179 |
+
self.name = six_module_name
|
| 180 |
+
self.known_modules = {}
|
| 181 |
+
|
| 182 |
+
def _add_module(self, mod, *fullnames):
|
| 183 |
+
for fullname in fullnames:
|
| 184 |
+
self.known_modules[self.name + "." + fullname] = mod
|
| 185 |
+
|
| 186 |
+
def _get_module(self, fullname):
|
| 187 |
+
return self.known_modules[self.name + "." + fullname]
|
| 188 |
+
|
| 189 |
+
def find_module(self, fullname, path=None):
|
| 190 |
+
if fullname in self.known_modules:
|
| 191 |
+
return self
|
| 192 |
+
return None
|
| 193 |
+
|
| 194 |
+
def find_spec(self, fullname, path, target=None):
|
| 195 |
+
if fullname in self.known_modules:
|
| 196 |
+
return spec_from_loader(fullname, self)
|
| 197 |
+
return None
|
| 198 |
+
|
| 199 |
+
def __get_module(self, fullname):
|
| 200 |
+
try:
|
| 201 |
+
return self.known_modules[fullname]
|
| 202 |
+
except KeyError:
|
| 203 |
+
raise ImportError("This loader does not know module " + fullname)
|
| 204 |
+
|
| 205 |
+
def load_module(self, fullname):
|
| 206 |
+
try:
|
| 207 |
+
# in case of a reload
|
| 208 |
+
return sys.modules[fullname]
|
| 209 |
+
except KeyError:
|
| 210 |
+
pass
|
| 211 |
+
mod = self.__get_module(fullname)
|
| 212 |
+
if isinstance(mod, MovedModule):
|
| 213 |
+
mod = mod._resolve()
|
| 214 |
+
else:
|
| 215 |
+
mod.__loader__ = self
|
| 216 |
+
sys.modules[fullname] = mod
|
| 217 |
+
return mod
|
| 218 |
+
|
| 219 |
+
def is_package(self, fullname):
|
| 220 |
+
"""
|
| 221 |
+
Return true, if the named module is a package.
|
| 222 |
+
|
| 223 |
+
We need this method to get correct spec objects with
|
| 224 |
+
Python 3.4 (see PEP451)
|
| 225 |
+
"""
|
| 226 |
+
return hasattr(self.__get_module(fullname), "__path__")
|
| 227 |
+
|
| 228 |
+
def get_code(self, fullname):
|
| 229 |
+
"""Return None
|
| 230 |
+
|
| 231 |
+
Required, if is_package is implemented"""
|
| 232 |
+
self.__get_module(fullname) # eventually raises ImportError
|
| 233 |
+
return None
|
| 234 |
+
get_source = get_code # same as get_code
|
| 235 |
+
|
| 236 |
+
def create_module(self, spec):
|
| 237 |
+
return self.load_module(spec.name)
|
| 238 |
+
|
| 239 |
+
def exec_module(self, module):
|
| 240 |
+
pass
|
| 241 |
+
|
| 242 |
+
_importer = _SixMetaPathImporter(__name__)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
class _MovedItems(_LazyModule):
|
| 246 |
+
|
| 247 |
+
"""Lazy loading of moved objects"""
|
| 248 |
+
__path__ = [] # mark as package
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
_moved_attributes = [
|
| 252 |
+
MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
|
| 253 |
+
MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
|
| 254 |
+
MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
|
| 255 |
+
MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
|
| 256 |
+
MovedAttribute("intern", "__builtin__", "sys"),
|
| 257 |
+
MovedAttribute("map", "itertools", "builtins", "imap", "map"),
|
| 258 |
+
MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
|
| 259 |
+
MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
|
| 260 |
+
MovedAttribute("getoutput", "commands", "subprocess"),
|
| 261 |
+
MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
|
| 262 |
+
MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
|
| 263 |
+
MovedAttribute("reduce", "__builtin__", "functools"),
|
| 264 |
+
MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
|
| 265 |
+
MovedAttribute("StringIO", "StringIO", "io"),
|
| 266 |
+
MovedAttribute("UserDict", "UserDict", "collections", "IterableUserDict", "UserDict"),
|
| 267 |
+
MovedAttribute("UserList", "UserList", "collections"),
|
| 268 |
+
MovedAttribute("UserString", "UserString", "collections"),
|
| 269 |
+
MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
|
| 270 |
+
MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
|
| 271 |
+
MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
|
| 272 |
+
MovedModule("builtins", "__builtin__"),
|
| 273 |
+
MovedModule("configparser", "ConfigParser"),
|
| 274 |
+
MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3, 3) else "collections"),
|
| 275 |
+
MovedModule("copyreg", "copy_reg"),
|
| 276 |
+
MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
|
| 277 |
+
MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"),
|
| 278 |
+
MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9) else "_thread"),
|
| 279 |
+
MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
|
| 280 |
+
MovedModule("http_cookies", "Cookie", "http.cookies"),
|
| 281 |
+
MovedModule("html_entities", "htmlentitydefs", "html.entities"),
|
| 282 |
+
MovedModule("html_parser", "HTMLParser", "html.parser"),
|
| 283 |
+
MovedModule("http_client", "httplib", "http.client"),
|
| 284 |
+
MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
|
| 285 |
+
MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"),
|
| 286 |
+
MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
|
| 287 |
+
MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
|
| 288 |
+
MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
|
| 289 |
+
MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
|
| 290 |
+
MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
|
| 291 |
+
MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
|
| 292 |
+
MovedModule("cPickle", "cPickle", "pickle"),
|
| 293 |
+
MovedModule("queue", "Queue"),
|
| 294 |
+
MovedModule("reprlib", "repr"),
|
| 295 |
+
MovedModule("socketserver", "SocketServer"),
|
| 296 |
+
MovedModule("_thread", "thread", "_thread"),
|
| 297 |
+
MovedModule("tkinter", "Tkinter"),
|
| 298 |
+
MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
|
| 299 |
+
MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
|
| 300 |
+
MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
|
| 301 |
+
MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
|
| 302 |
+
MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
|
| 303 |
+
MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
|
| 304 |
+
MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
|
| 305 |
+
MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
|
| 306 |
+
MovedModule("tkinter_colorchooser", "tkColorChooser",
|
| 307 |
+
"tkinter.colorchooser"),
|
| 308 |
+
MovedModule("tkinter_commondialog", "tkCommonDialog",
|
| 309 |
+
"tkinter.commondialog"),
|
| 310 |
+
MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
|
| 311 |
+
MovedModule("tkinter_font", "tkFont", "tkinter.font"),
|
| 312 |
+
MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
|
| 313 |
+
MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
|
| 314 |
+
"tkinter.simpledialog"),
|
| 315 |
+
MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
|
| 316 |
+
MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
|
| 317 |
+
MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
|
| 318 |
+
MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"),
|
| 319 |
+
MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"),
|
| 320 |
+
MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"),
|
| 321 |
+
]
|
| 322 |
+
# Add windows specific modules.
|
| 323 |
+
if sys.platform == "win32":
|
| 324 |
+
_moved_attributes += [
|
| 325 |
+
MovedModule("winreg", "_winreg"),
|
| 326 |
+
]
|
| 327 |
+
|
| 328 |
+
for attr in _moved_attributes:
|
| 329 |
+
setattr(_MovedItems, attr.name, attr)
|
| 330 |
+
if isinstance(attr, MovedModule):
|
| 331 |
+
_importer._add_module(attr, "moves." + attr.name)
|
| 332 |
+
del attr
|
| 333 |
+
|
| 334 |
+
_MovedItems._moved_attributes = _moved_attributes
|
| 335 |
+
|
| 336 |
+
moves = _MovedItems(__name__ + ".moves")
|
| 337 |
+
_importer._add_module(moves, "moves")
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
class Module_six_moves_urllib_parse(_LazyModule):
|
| 341 |
+
|
| 342 |
+
"""Lazy loading of moved objects in six.moves.urllib_parse"""
|
| 343 |
+
|
| 344 |
+
|
| 345 |
+
_urllib_parse_moved_attributes = [
|
| 346 |
+
MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
|
| 347 |
+
MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
|
| 348 |
+
MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
|
| 349 |
+
MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
|
| 350 |
+
MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
|
| 351 |
+
MovedAttribute("urljoin", "urlparse", "urllib.parse"),
|
| 352 |
+
MovedAttribute("urlparse", "urlparse", "urllib.parse"),
|
| 353 |
+
MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
|
| 354 |
+
MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
|
| 355 |
+
MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
|
| 356 |
+
MovedAttribute("quote", "urllib", "urllib.parse"),
|
| 357 |
+
MovedAttribute("quote_plus", "urllib", "urllib.parse"),
|
| 358 |
+
MovedAttribute("unquote", "urllib", "urllib.parse"),
|
| 359 |
+
MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
|
| 360 |
+
MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"),
|
| 361 |
+
MovedAttribute("urlencode", "urllib", "urllib.parse"),
|
| 362 |
+
MovedAttribute("splitquery", "urllib", "urllib.parse"),
|
| 363 |
+
MovedAttribute("splittag", "urllib", "urllib.parse"),
|
| 364 |
+
MovedAttribute("splituser", "urllib", "urllib.parse"),
|
| 365 |
+
MovedAttribute("splitvalue", "urllib", "urllib.parse"),
|
| 366 |
+
MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
|
| 367 |
+
MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
|
| 368 |
+
MovedAttribute("uses_params", "urlparse", "urllib.parse"),
|
| 369 |
+
MovedAttribute("uses_query", "urlparse", "urllib.parse"),
|
| 370 |
+
MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
|
| 371 |
+
]
|
| 372 |
+
for attr in _urllib_parse_moved_attributes:
|
| 373 |
+
setattr(Module_six_moves_urllib_parse, attr.name, attr)
|
| 374 |
+
del attr
|
| 375 |
+
|
| 376 |
+
Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
|
| 377 |
+
|
| 378 |
+
_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
|
| 379 |
+
"moves.urllib_parse", "moves.urllib.parse")
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
class Module_six_moves_urllib_error(_LazyModule):
|
| 383 |
+
|
| 384 |
+
"""Lazy loading of moved objects in six.moves.urllib_error"""
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
_urllib_error_moved_attributes = [
|
| 388 |
+
MovedAttribute("URLError", "urllib2", "urllib.error"),
|
| 389 |
+
MovedAttribute("HTTPError", "urllib2", "urllib.error"),
|
| 390 |
+
MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
|
| 391 |
+
]
|
| 392 |
+
for attr in _urllib_error_moved_attributes:
|
| 393 |
+
setattr(Module_six_moves_urllib_error, attr.name, attr)
|
| 394 |
+
del attr
|
| 395 |
+
|
| 396 |
+
Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
|
| 397 |
+
|
| 398 |
+
_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
|
| 399 |
+
"moves.urllib_error", "moves.urllib.error")
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
class Module_six_moves_urllib_request(_LazyModule):
|
| 403 |
+
|
| 404 |
+
"""Lazy loading of moved objects in six.moves.urllib_request"""
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
_urllib_request_moved_attributes = [
|
| 408 |
+
MovedAttribute("urlopen", "urllib2", "urllib.request"),
|
| 409 |
+
MovedAttribute("install_opener", "urllib2", "urllib.request"),
|
| 410 |
+
MovedAttribute("build_opener", "urllib2", "urllib.request"),
|
| 411 |
+
MovedAttribute("pathname2url", "urllib", "urllib.request"),
|
| 412 |
+
MovedAttribute("url2pathname", "urllib", "urllib.request"),
|
| 413 |
+
MovedAttribute("getproxies", "urllib", "urllib.request"),
|
| 414 |
+
MovedAttribute("Request", "urllib2", "urllib.request"),
|
| 415 |
+
MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
|
| 416 |
+
MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
|
| 417 |
+
MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
|
| 418 |
+
MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
|
| 419 |
+
MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
|
| 420 |
+
MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
|
| 421 |
+
MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
|
| 422 |
+
MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
|
| 423 |
+
MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
|
| 424 |
+
MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
|
| 425 |
+
MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
|
| 426 |
+
MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
|
| 427 |
+
MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
|
| 428 |
+
MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
|
| 429 |
+
MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
|
| 430 |
+
MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
|
| 431 |
+
MovedAttribute("FileHandler", "urllib2", "urllib.request"),
|
| 432 |
+
MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
|
| 433 |
+
MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
|
| 434 |
+
MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
|
| 435 |
+
MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
|
| 436 |
+
MovedAttribute("urlretrieve", "urllib", "urllib.request"),
|
| 437 |
+
MovedAttribute("urlcleanup", "urllib", "urllib.request"),
|
| 438 |
+
MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
|
| 439 |
+
MovedAttribute("parse_http_list", "urllib2", "urllib.request"),
|
| 440 |
+
MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),
|
| 441 |
+
]
|
| 442 |
+
if sys.version_info[:2] < (3, 14):
|
| 443 |
+
_urllib_request_moved_attributes.extend(
|
| 444 |
+
[
|
| 445 |
+
MovedAttribute("URLopener", "urllib", "urllib.request"),
|
| 446 |
+
MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
|
| 447 |
+
]
|
| 448 |
+
)
|
| 449 |
+
for attr in _urllib_request_moved_attributes:
|
| 450 |
+
setattr(Module_six_moves_urllib_request, attr.name, attr)
|
| 451 |
+
del attr
|
| 452 |
+
|
| 453 |
+
Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
|
| 454 |
+
|
| 455 |
+
_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
|
| 456 |
+
"moves.urllib_request", "moves.urllib.request")
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
class Module_six_moves_urllib_response(_LazyModule):
|
| 460 |
+
|
| 461 |
+
"""Lazy loading of moved objects in six.moves.urllib_response"""
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
_urllib_response_moved_attributes = [
|
| 465 |
+
MovedAttribute("addbase", "urllib", "urllib.response"),
|
| 466 |
+
MovedAttribute("addclosehook", "urllib", "urllib.response"),
|
| 467 |
+
MovedAttribute("addinfo", "urllib", "urllib.response"),
|
| 468 |
+
MovedAttribute("addinfourl", "urllib", "urllib.response"),
|
| 469 |
+
]
|
| 470 |
+
for attr in _urllib_response_moved_attributes:
|
| 471 |
+
setattr(Module_six_moves_urllib_response, attr.name, attr)
|
| 472 |
+
del attr
|
| 473 |
+
|
| 474 |
+
Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
|
| 475 |
+
|
| 476 |
+
_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
|
| 477 |
+
"moves.urllib_response", "moves.urllib.response")
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
class Module_six_moves_urllib_robotparser(_LazyModule):
|
| 481 |
+
|
| 482 |
+
"""Lazy loading of moved objects in six.moves.urllib_robotparser"""
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
_urllib_robotparser_moved_attributes = [
|
| 486 |
+
MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
|
| 487 |
+
]
|
| 488 |
+
for attr in _urllib_robotparser_moved_attributes:
|
| 489 |
+
setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
|
| 490 |
+
del attr
|
| 491 |
+
|
| 492 |
+
Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
|
| 493 |
+
|
| 494 |
+
_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"),
|
| 495 |
+
"moves.urllib_robotparser", "moves.urllib.robotparser")
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
class Module_six_moves_urllib(types.ModuleType):
|
| 499 |
+
|
| 500 |
+
"""Create a six.moves.urllib namespace that resembles the Python 3 namespace"""
|
| 501 |
+
__path__ = [] # mark as package
|
| 502 |
+
parse = _importer._get_module("moves.urllib_parse")
|
| 503 |
+
error = _importer._get_module("moves.urllib_error")
|
| 504 |
+
request = _importer._get_module("moves.urllib_request")
|
| 505 |
+
response = _importer._get_module("moves.urllib_response")
|
| 506 |
+
robotparser = _importer._get_module("moves.urllib_robotparser")
|
| 507 |
+
|
| 508 |
+
def __dir__(self):
|
| 509 |
+
return ['parse', 'error', 'request', 'response', 'robotparser']
|
| 510 |
+
|
| 511 |
+
_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
|
| 512 |
+
"moves.urllib")
|
| 513 |
+
|
| 514 |
+
|
| 515 |
+
def add_move(move):
|
| 516 |
+
"""Add an item to six.moves."""
|
| 517 |
+
setattr(_MovedItems, move.name, move)
|
| 518 |
+
|
| 519 |
+
|
| 520 |
+
def remove_move(name):
|
| 521 |
+
"""Remove item from six.moves."""
|
| 522 |
+
try:
|
| 523 |
+
delattr(_MovedItems, name)
|
| 524 |
+
except AttributeError:
|
| 525 |
+
try:
|
| 526 |
+
del moves.__dict__[name]
|
| 527 |
+
except KeyError:
|
| 528 |
+
raise AttributeError("no such move, %r" % (name,))
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
if PY3:
|
| 532 |
+
_meth_func = "__func__"
|
| 533 |
+
_meth_self = "__self__"
|
| 534 |
+
|
| 535 |
+
_func_closure = "__closure__"
|
| 536 |
+
_func_code = "__code__"
|
| 537 |
+
_func_defaults = "__defaults__"
|
| 538 |
+
_func_globals = "__globals__"
|
| 539 |
+
else:
|
| 540 |
+
_meth_func = "im_func"
|
| 541 |
+
_meth_self = "im_self"
|
| 542 |
+
|
| 543 |
+
_func_closure = "func_closure"
|
| 544 |
+
_func_code = "func_code"
|
| 545 |
+
_func_defaults = "func_defaults"
|
| 546 |
+
_func_globals = "func_globals"
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
try:
|
| 550 |
+
advance_iterator = next
|
| 551 |
+
except NameError:
|
| 552 |
+
def advance_iterator(it):
|
| 553 |
+
return it.next()
|
| 554 |
+
next = advance_iterator
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
try:
|
| 558 |
+
callable = callable
|
| 559 |
+
except NameError:
|
| 560 |
+
def callable(obj):
|
| 561 |
+
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
|
| 562 |
+
|
| 563 |
+
|
| 564 |
+
if PY3:
|
| 565 |
+
def get_unbound_function(unbound):
|
| 566 |
+
return unbound
|
| 567 |
+
|
| 568 |
+
create_bound_method = types.MethodType
|
| 569 |
+
|
| 570 |
+
def create_unbound_method(func, cls):
|
| 571 |
+
return func
|
| 572 |
+
|
| 573 |
+
Iterator = object
|
| 574 |
+
else:
|
| 575 |
+
def get_unbound_function(unbound):
|
| 576 |
+
return unbound.im_func
|
| 577 |
+
|
| 578 |
+
def create_bound_method(func, obj):
|
| 579 |
+
return types.MethodType(func, obj, obj.__class__)
|
| 580 |
+
|
| 581 |
+
def create_unbound_method(func, cls):
|
| 582 |
+
return types.MethodType(func, None, cls)
|
| 583 |
+
|
| 584 |
+
class Iterator(object):
|
| 585 |
+
|
| 586 |
+
def next(self):
|
| 587 |
+
return type(self).__next__(self)
|
| 588 |
+
|
| 589 |
+
callable = callable
|
| 590 |
+
_add_doc(get_unbound_function,
|
| 591 |
+
"""Get the function out of a possibly unbound function""")
|
| 592 |
+
|
| 593 |
+
|
| 594 |
+
get_method_function = operator.attrgetter(_meth_func)
|
| 595 |
+
get_method_self = operator.attrgetter(_meth_self)
|
| 596 |
+
get_function_closure = operator.attrgetter(_func_closure)
|
| 597 |
+
get_function_code = operator.attrgetter(_func_code)
|
| 598 |
+
get_function_defaults = operator.attrgetter(_func_defaults)
|
| 599 |
+
get_function_globals = operator.attrgetter(_func_globals)
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
if PY3:
|
| 603 |
+
def iterkeys(d, **kw):
|
| 604 |
+
return iter(d.keys(**kw))
|
| 605 |
+
|
| 606 |
+
def itervalues(d, **kw):
|
| 607 |
+
return iter(d.values(**kw))
|
| 608 |
+
|
| 609 |
+
def iteritems(d, **kw):
|
| 610 |
+
return iter(d.items(**kw))
|
| 611 |
+
|
| 612 |
+
def iterlists(d, **kw):
|
| 613 |
+
return iter(d.lists(**kw))
|
| 614 |
+
|
| 615 |
+
viewkeys = operator.methodcaller("keys")
|
| 616 |
+
|
| 617 |
+
viewvalues = operator.methodcaller("values")
|
| 618 |
+
|
| 619 |
+
viewitems = operator.methodcaller("items")
|
| 620 |
+
else:
|
| 621 |
+
def iterkeys(d, **kw):
|
| 622 |
+
return d.iterkeys(**kw)
|
| 623 |
+
|
| 624 |
+
def itervalues(d, **kw):
|
| 625 |
+
return d.itervalues(**kw)
|
| 626 |
+
|
| 627 |
+
def iteritems(d, **kw):
|
| 628 |
+
return d.iteritems(**kw)
|
| 629 |
+
|
| 630 |
+
def iterlists(d, **kw):
|
| 631 |
+
return d.iterlists(**kw)
|
| 632 |
+
|
| 633 |
+
viewkeys = operator.methodcaller("viewkeys")
|
| 634 |
+
|
| 635 |
+
viewvalues = operator.methodcaller("viewvalues")
|
| 636 |
+
|
| 637 |
+
viewitems = operator.methodcaller("viewitems")
|
| 638 |
+
|
| 639 |
+
_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.")
|
| 640 |
+
_add_doc(itervalues, "Return an iterator over the values of a dictionary.")
|
| 641 |
+
_add_doc(iteritems,
|
| 642 |
+
"Return an iterator over the (key, value) pairs of a dictionary.")
|
| 643 |
+
_add_doc(iterlists,
|
| 644 |
+
"Return an iterator over the (key, [values]) pairs of a dictionary.")
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
if PY3:
|
| 648 |
+
def b(s):
|
| 649 |
+
return s.encode("latin-1")
|
| 650 |
+
|
| 651 |
+
def u(s):
|
| 652 |
+
return s
|
| 653 |
+
unichr = chr
|
| 654 |
+
import struct
|
| 655 |
+
int2byte = struct.Struct(">B").pack
|
| 656 |
+
del struct
|
| 657 |
+
byte2int = operator.itemgetter(0)
|
| 658 |
+
indexbytes = operator.getitem
|
| 659 |
+
iterbytes = iter
|
| 660 |
+
import io
|
| 661 |
+
StringIO = io.StringIO
|
| 662 |
+
BytesIO = io.BytesIO
|
| 663 |
+
del io
|
| 664 |
+
_assertCountEqual = "assertCountEqual"
|
| 665 |
+
if sys.version_info[1] <= 1:
|
| 666 |
+
_assertRaisesRegex = "assertRaisesRegexp"
|
| 667 |
+
_assertRegex = "assertRegexpMatches"
|
| 668 |
+
_assertNotRegex = "assertNotRegexpMatches"
|
| 669 |
+
else:
|
| 670 |
+
_assertRaisesRegex = "assertRaisesRegex"
|
| 671 |
+
_assertRegex = "assertRegex"
|
| 672 |
+
_assertNotRegex = "assertNotRegex"
|
| 673 |
+
else:
|
| 674 |
+
def b(s):
|
| 675 |
+
return s
|
| 676 |
+
# Workaround for standalone backslash
|
| 677 |
+
|
| 678 |
+
def u(s):
|
| 679 |
+
return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
|
| 680 |
+
unichr = unichr
|
| 681 |
+
int2byte = chr
|
| 682 |
+
|
| 683 |
+
def byte2int(bs):
|
| 684 |
+
return ord(bs[0])
|
| 685 |
+
|
| 686 |
+
def indexbytes(buf, i):
|
| 687 |
+
return ord(buf[i])
|
| 688 |
+
iterbytes = functools.partial(itertools.imap, ord)
|
| 689 |
+
import StringIO
|
| 690 |
+
StringIO = BytesIO = StringIO.StringIO
|
| 691 |
+
_assertCountEqual = "assertItemsEqual"
|
| 692 |
+
_assertRaisesRegex = "assertRaisesRegexp"
|
| 693 |
+
_assertRegex = "assertRegexpMatches"
|
| 694 |
+
_assertNotRegex = "assertNotRegexpMatches"
|
| 695 |
+
_add_doc(b, """Byte literal""")
|
| 696 |
+
_add_doc(u, """Text literal""")
|
| 697 |
+
|
| 698 |
+
|
| 699 |
+
def assertCountEqual(self, *args, **kwargs):
|
| 700 |
+
return getattr(self, _assertCountEqual)(*args, **kwargs)
|
| 701 |
+
|
| 702 |
+
|
| 703 |
+
def assertRaisesRegex(self, *args, **kwargs):
|
| 704 |
+
return getattr(self, _assertRaisesRegex)(*args, **kwargs)
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
def assertRegex(self, *args, **kwargs):
|
| 708 |
+
return getattr(self, _assertRegex)(*args, **kwargs)
|
| 709 |
+
|
| 710 |
+
|
| 711 |
+
def assertNotRegex(self, *args, **kwargs):
|
| 712 |
+
return getattr(self, _assertNotRegex)(*args, **kwargs)
|
| 713 |
+
|
| 714 |
+
|
| 715 |
+
if PY3:
|
| 716 |
+
exec_ = getattr(moves.builtins, "exec")
|
| 717 |
+
|
| 718 |
+
def reraise(tp, value, tb=None):
|
| 719 |
+
try:
|
| 720 |
+
if value is None:
|
| 721 |
+
value = tp()
|
| 722 |
+
if value.__traceback__ is not tb:
|
| 723 |
+
raise value.with_traceback(tb)
|
| 724 |
+
raise value
|
| 725 |
+
finally:
|
| 726 |
+
value = None
|
| 727 |
+
tb = None
|
| 728 |
+
|
| 729 |
+
else:
|
| 730 |
+
def exec_(_code_, _globs_=None, _locs_=None):
|
| 731 |
+
"""Execute code in a namespace."""
|
| 732 |
+
if _globs_ is None:
|
| 733 |
+
frame = sys._getframe(1)
|
| 734 |
+
_globs_ = frame.f_globals
|
| 735 |
+
if _locs_ is None:
|
| 736 |
+
_locs_ = frame.f_locals
|
| 737 |
+
del frame
|
| 738 |
+
elif _locs_ is None:
|
| 739 |
+
_locs_ = _globs_
|
| 740 |
+
exec("""exec _code_ in _globs_, _locs_""")
|
| 741 |
+
|
| 742 |
+
exec_("""def reraise(tp, value, tb=None):
|
| 743 |
+
try:
|
| 744 |
+
raise tp, value, tb
|
| 745 |
+
finally:
|
| 746 |
+
tb = None
|
| 747 |
+
""")
|
| 748 |
+
|
| 749 |
+
|
| 750 |
+
if sys.version_info[:2] > (3,):
|
| 751 |
+
exec_("""def raise_from(value, from_value):
|
| 752 |
+
try:
|
| 753 |
+
raise value from from_value
|
| 754 |
+
finally:
|
| 755 |
+
value = None
|
| 756 |
+
""")
|
| 757 |
+
else:
|
| 758 |
+
def raise_from(value, from_value):
|
| 759 |
+
raise value
|
| 760 |
+
|
| 761 |
+
|
| 762 |
+
print_ = getattr(moves.builtins, "print", None)
|
| 763 |
+
if print_ is None:
|
| 764 |
+
def print_(*args, **kwargs):
|
| 765 |
+
"""The new-style print function for Python 2.4 and 2.5."""
|
| 766 |
+
fp = kwargs.pop("file", sys.stdout)
|
| 767 |
+
if fp is None:
|
| 768 |
+
return
|
| 769 |
+
|
| 770 |
+
def write(data):
|
| 771 |
+
if not isinstance(data, basestring):
|
| 772 |
+
data = str(data)
|
| 773 |
+
# If the file has an encoding, encode unicode with it.
|
| 774 |
+
if (isinstance(fp, file) and
|
| 775 |
+
isinstance(data, unicode) and
|
| 776 |
+
fp.encoding is not None):
|
| 777 |
+
errors = getattr(fp, "errors", None)
|
| 778 |
+
if errors is None:
|
| 779 |
+
errors = "strict"
|
| 780 |
+
data = data.encode(fp.encoding, errors)
|
| 781 |
+
fp.write(data)
|
| 782 |
+
want_unicode = False
|
| 783 |
+
sep = kwargs.pop("sep", None)
|
| 784 |
+
if sep is not None:
|
| 785 |
+
if isinstance(sep, unicode):
|
| 786 |
+
want_unicode = True
|
| 787 |
+
elif not isinstance(sep, str):
|
| 788 |
+
raise TypeError("sep must be None or a string")
|
| 789 |
+
end = kwargs.pop("end", None)
|
| 790 |
+
if end is not None:
|
| 791 |
+
if isinstance(end, unicode):
|
| 792 |
+
want_unicode = True
|
| 793 |
+
elif not isinstance(end, str):
|
| 794 |
+
raise TypeError("end must be None or a string")
|
| 795 |
+
if kwargs:
|
| 796 |
+
raise TypeError("invalid keyword arguments to print()")
|
| 797 |
+
if not want_unicode:
|
| 798 |
+
for arg in args:
|
| 799 |
+
if isinstance(arg, unicode):
|
| 800 |
+
want_unicode = True
|
| 801 |
+
break
|
| 802 |
+
if want_unicode:
|
| 803 |
+
newline = unicode("\n")
|
| 804 |
+
space = unicode(" ")
|
| 805 |
+
else:
|
| 806 |
+
newline = "\n"
|
| 807 |
+
space = " "
|
| 808 |
+
if sep is None:
|
| 809 |
+
sep = space
|
| 810 |
+
if end is None:
|
| 811 |
+
end = newline
|
| 812 |
+
for i, arg in enumerate(args):
|
| 813 |
+
if i:
|
| 814 |
+
write(sep)
|
| 815 |
+
write(arg)
|
| 816 |
+
write(end)
|
| 817 |
+
if sys.version_info[:2] < (3, 3):
|
| 818 |
+
_print = print_
|
| 819 |
+
|
| 820 |
+
def print_(*args, **kwargs):
|
| 821 |
+
fp = kwargs.get("file", sys.stdout)
|
| 822 |
+
flush = kwargs.pop("flush", False)
|
| 823 |
+
_print(*args, **kwargs)
|
| 824 |
+
if flush and fp is not None:
|
| 825 |
+
fp.flush()
|
| 826 |
+
|
| 827 |
+
_add_doc(reraise, """Reraise an exception.""")
|
| 828 |
+
|
| 829 |
+
if sys.version_info[0:2] < (3, 4):
|
| 830 |
+
# This does exactly the same what the :func:`py3:functools.update_wrapper`
|
| 831 |
+
# function does on Python versions after 3.2. It sets the ``__wrapped__``
|
| 832 |
+
# attribute on ``wrapper`` object and it doesn't raise an error if any of
|
| 833 |
+
# the attributes mentioned in ``assigned`` and ``updated`` are missing on
|
| 834 |
+
# ``wrapped`` object.
|
| 835 |
+
def _update_wrapper(wrapper, wrapped,
|
| 836 |
+
assigned=functools.WRAPPER_ASSIGNMENTS,
|
| 837 |
+
updated=functools.WRAPPER_UPDATES):
|
| 838 |
+
for attr in assigned:
|
| 839 |
+
try:
|
| 840 |
+
value = getattr(wrapped, attr)
|
| 841 |
+
except AttributeError:
|
| 842 |
+
continue
|
| 843 |
+
else:
|
| 844 |
+
setattr(wrapper, attr, value)
|
| 845 |
+
for attr in updated:
|
| 846 |
+
getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
|
| 847 |
+
wrapper.__wrapped__ = wrapped
|
| 848 |
+
return wrapper
|
| 849 |
+
_update_wrapper.__doc__ = functools.update_wrapper.__doc__
|
| 850 |
+
|
| 851 |
+
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
|
| 852 |
+
updated=functools.WRAPPER_UPDATES):
|
| 853 |
+
return functools.partial(_update_wrapper, wrapped=wrapped,
|
| 854 |
+
assigned=assigned, updated=updated)
|
| 855 |
+
wraps.__doc__ = functools.wraps.__doc__
|
| 856 |
+
|
| 857 |
+
else:
|
| 858 |
+
wraps = functools.wraps
|
| 859 |
+
|
| 860 |
+
|
| 861 |
+
def with_metaclass(meta, *bases):
|
| 862 |
+
"""Create a base class with a metaclass."""
|
| 863 |
+
# This requires a bit of explanation: the basic idea is to make a dummy
|
| 864 |
+
# metaclass for one level of class instantiation that replaces itself with
|
| 865 |
+
# the actual metaclass.
|
| 866 |
+
class metaclass(type):
|
| 867 |
+
|
| 868 |
+
def __new__(cls, name, this_bases, d):
|
| 869 |
+
if sys.version_info[:2] >= (3, 7):
|
| 870 |
+
# This version introduced PEP 560 that requires a bit
|
| 871 |
+
# of extra care (we mimic what is done by __build_class__).
|
| 872 |
+
resolved_bases = types.resolve_bases(bases)
|
| 873 |
+
if resolved_bases is not bases:
|
| 874 |
+
d['__orig_bases__'] = bases
|
| 875 |
+
else:
|
| 876 |
+
resolved_bases = bases
|
| 877 |
+
return meta(name, resolved_bases, d)
|
| 878 |
+
|
| 879 |
+
@classmethod
|
| 880 |
+
def __prepare__(cls, name, this_bases):
|
| 881 |
+
return meta.__prepare__(name, bases)
|
| 882 |
+
return type.__new__(metaclass, 'temporary_class', (), {})
|
| 883 |
+
|
| 884 |
+
|
| 885 |
+
def add_metaclass(metaclass):
|
| 886 |
+
"""Class decorator for creating a class with a metaclass."""
|
| 887 |
+
def wrapper(cls):
|
| 888 |
+
orig_vars = cls.__dict__.copy()
|
| 889 |
+
slots = orig_vars.get('__slots__')
|
| 890 |
+
if slots is not None:
|
| 891 |
+
if isinstance(slots, str):
|
| 892 |
+
slots = [slots]
|
| 893 |
+
for slots_var in slots:
|
| 894 |
+
orig_vars.pop(slots_var)
|
| 895 |
+
orig_vars.pop('__dict__', None)
|
| 896 |
+
orig_vars.pop('__weakref__', None)
|
| 897 |
+
if hasattr(cls, '__qualname__'):
|
| 898 |
+
orig_vars['__qualname__'] = cls.__qualname__
|
| 899 |
+
return metaclass(cls.__name__, cls.__bases__, orig_vars)
|
| 900 |
+
return wrapper
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
def ensure_binary(s, encoding='utf-8', errors='strict'):
|
| 904 |
+
"""Coerce **s** to six.binary_type.
|
| 905 |
+
|
| 906 |
+
For Python 2:
|
| 907 |
+
- `unicode` -> encoded to `str`
|
| 908 |
+
- `str` -> `str`
|
| 909 |
+
|
| 910 |
+
For Python 3:
|
| 911 |
+
- `str` -> encoded to `bytes`
|
| 912 |
+
- `bytes` -> `bytes`
|
| 913 |
+
"""
|
| 914 |
+
if isinstance(s, binary_type):
|
| 915 |
+
return s
|
| 916 |
+
if isinstance(s, text_type):
|
| 917 |
+
return s.encode(encoding, errors)
|
| 918 |
+
raise TypeError("not expecting type '%s'" % type(s))
|
| 919 |
+
|
| 920 |
+
|
| 921 |
+
def ensure_str(s, encoding='utf-8', errors='strict'):
|
| 922 |
+
"""Coerce *s* to `str`.
|
| 923 |
+
|
| 924 |
+
For Python 2:
|
| 925 |
+
- `unicode` -> encoded to `str`
|
| 926 |
+
- `str` -> `str`
|
| 927 |
+
|
| 928 |
+
For Python 3:
|
| 929 |
+
- `str` -> `str`
|
| 930 |
+
- `bytes` -> decoded to `str`
|
| 931 |
+
"""
|
| 932 |
+
# Optimization: Fast return for the common case.
|
| 933 |
+
if type(s) is str:
|
| 934 |
+
return s
|
| 935 |
+
if PY2 and isinstance(s, text_type):
|
| 936 |
+
return s.encode(encoding, errors)
|
| 937 |
+
elif PY3 and isinstance(s, binary_type):
|
| 938 |
+
return s.decode(encoding, errors)
|
| 939 |
+
elif not isinstance(s, (text_type, binary_type)):
|
| 940 |
+
raise TypeError("not expecting type '%s'" % type(s))
|
| 941 |
+
return s
|
| 942 |
+
|
| 943 |
+
|
| 944 |
+
def ensure_text(s, encoding='utf-8', errors='strict'):
|
| 945 |
+
"""Coerce *s* to six.text_type.
|
| 946 |
+
|
| 947 |
+
For Python 2:
|
| 948 |
+
- `unicode` -> `unicode`
|
| 949 |
+
- `str` -> `unicode`
|
| 950 |
+
|
| 951 |
+
For Python 3:
|
| 952 |
+
- `str` -> `str`
|
| 953 |
+
- `bytes` -> decoded to `str`
|
| 954 |
+
"""
|
| 955 |
+
if isinstance(s, binary_type):
|
| 956 |
+
return s.decode(encoding, errors)
|
| 957 |
+
elif isinstance(s, text_type):
|
| 958 |
+
return s
|
| 959 |
+
else:
|
| 960 |
+
raise TypeError("not expecting type '%s'" % type(s))
|
| 961 |
+
|
| 962 |
+
|
| 963 |
+
def python_2_unicode_compatible(klass):
|
| 964 |
+
"""
|
| 965 |
+
A class decorator that defines __unicode__ and __str__ methods under Python 2.
|
| 966 |
+
Under Python 3 it does nothing.
|
| 967 |
+
|
| 968 |
+
To support Python 2 and 3 with a single code base, define a __str__ method
|
| 969 |
+
returning text and apply this decorator to the class.
|
| 970 |
+
"""
|
| 971 |
+
if PY2:
|
| 972 |
+
if '__str__' not in klass.__dict__:
|
| 973 |
+
raise ValueError("@python_2_unicode_compatible cannot be applied "
|
| 974 |
+
"to %s because it doesn't define __str__()." %
|
| 975 |
+
klass.__name__)
|
| 976 |
+
klass.__unicode__ = klass.__str__
|
| 977 |
+
klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
|
| 978 |
+
return klass
|
| 979 |
+
|
| 980 |
+
|
| 981 |
+
# Complete the moves implementation.
|
| 982 |
+
# This code is at the end of this module to speed up module loading.
|
| 983 |
+
# Turn this module into a package.
|
| 984 |
+
__path__ = [] # required for PEP 302 and PEP 451
|
| 985 |
+
__package__ = __name__ # see PEP 366 @ReservedAssignment
|
| 986 |
+
if globals().get("__spec__") is not None:
|
| 987 |
+
__spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable
|
| 988 |
+
# Remove other six meta path importers, since they cause problems. This can
|
| 989 |
+
# happen if six is removed from sys.modules and then reloaded. (Setuptools does
|
| 990 |
+
# this for some reason.)
|
| 991 |
+
if sys.meta_path:
|
| 992 |
+
for i, importer in enumerate(sys.meta_path):
|
| 993 |
+
# Here's some real nastiness: Another "instance" of the six module might
|
| 994 |
+
# be floating around. Therefore, we can't use isinstance() to check for
|
| 995 |
+
# the six meta path importer, since the other six instance will have
|
| 996 |
+
# inserted an importer with different class.
|
| 997 |
+
if (type(importer).__name__ == "_SixMetaPathImporter" and
|
| 998 |
+
importer.name == __name__):
|
| 999 |
+
del sys.meta_path[i]
|
| 1000 |
+
break
|
| 1001 |
+
del i, importer
|
| 1002 |
+
# Finally, add the importer to the meta path import hook.
|
| 1003 |
+
sys.meta_path.append(_importer)
|
CasualLab/.venv/lib/python3.12/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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""threadpoolctl
|
| 2 |
+
|
| 3 |
+
This module provides utilities to introspect native libraries that relies on
|
| 4 |
+
thread pools (notably BLAS and OpenMP implementations) and dynamically set the
|
| 5 |
+
maximal number of threads they can use.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
# License: BSD 3-Clause
|
| 9 |
+
|
| 10 |
+
# The code to introspect dynamically loaded libraries on POSIX systems is
|
| 11 |
+
# adapted from code by Intel developer @anton-malakhov available at
|
| 12 |
+
# https://github.com/IntelPython/smp (Copyright (c) 2017, Intel Corporation)
|
| 13 |
+
# and also published under the BSD 3-Clause license
|
| 14 |
+
import os
|
| 15 |
+
import re
|
| 16 |
+
import sys
|
| 17 |
+
import ctypes
|
| 18 |
+
import itertools
|
| 19 |
+
import textwrap
|
| 20 |
+
from typing import final
|
| 21 |
+
import warnings
|
| 22 |
+
from ctypes.util import find_library
|
| 23 |
+
from abc import ABC, abstractmethod
|
| 24 |
+
from functools import lru_cache
|
| 25 |
+
from contextlib import ContextDecorator
|
| 26 |
+
|
| 27 |
+
__version__ = "3.6.0"
|
| 28 |
+
__all__ = [
|
| 29 |
+
"threadpool_limits",
|
| 30 |
+
"threadpool_info",
|
| 31 |
+
"ThreadpoolController",
|
| 32 |
+
"LibController",
|
| 33 |
+
"register",
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# One can get runtime errors or even segfaults due to multiple OpenMP libraries
|
| 38 |
+
# loaded simultaneously which can happen easily in Python when importing and
|
| 39 |
+
# using compiled extensions built with different compilers and therefore
|
| 40 |
+
# different OpenMP runtimes in the same program. In particular libiomp (used by
|
| 41 |
+
# Intel ICC) and libomp used by clang/llvm tend to crash. This can happen for
|
| 42 |
+
# instance when calling BLAS inside a prange. Setting the following environment
|
| 43 |
+
# variable allows multiple OpenMP libraries to be loaded. It should not degrade
|
| 44 |
+
# performances since we manually take care of potential over-subscription
|
| 45 |
+
# performance issues, in sections of the code where nested OpenMP loops can
|
| 46 |
+
# happen, by dynamically reconfiguring the inner OpenMP runtime to temporarily
|
| 47 |
+
# disable it while under the scope of the outer OpenMP parallel section.
|
| 48 |
+
os.environ.setdefault("KMP_DUPLICATE_LIB_OK", "True")
|
| 49 |
+
|
| 50 |
+
# Structure to cast the info on dynamically loaded library. See
|
| 51 |
+
# https://linux.die.net/man/3/dl_iterate_phdr for more details.
|
| 52 |
+
_SYSTEM_UINT = ctypes.c_uint64 if sys.maxsize > 2**32 else ctypes.c_uint32
|
| 53 |
+
_SYSTEM_UINT_HALF = ctypes.c_uint32 if sys.maxsize > 2**32 else ctypes.c_uint16
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class _dl_phdr_info(ctypes.Structure):
|
| 57 |
+
_fields_ = [
|
| 58 |
+
("dlpi_addr", _SYSTEM_UINT), # Base address of object
|
| 59 |
+
("dlpi_name", ctypes.c_char_p), # path to the library
|
| 60 |
+
("dlpi_phdr", ctypes.c_void_p), # pointer on dlpi_headers
|
| 61 |
+
("dlpi_phnum", _SYSTEM_UINT_HALF), # number of elements in dlpi_phdr
|
| 62 |
+
]
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# The RTLD_NOLOAD flag for loading shared libraries is not defined on Windows.
|
| 66 |
+
try:
|
| 67 |
+
_RTLD_NOLOAD = os.RTLD_NOLOAD
|
| 68 |
+
except AttributeError:
|
| 69 |
+
_RTLD_NOLOAD = ctypes.DEFAULT_MODE
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class LibController(ABC):
|
| 73 |
+
"""Abstract base class for the individual library controllers
|
| 74 |
+
|
| 75 |
+
A library controller must expose the following class attributes:
|
| 76 |
+
- user_api : str
|
| 77 |
+
Usually the name of the library or generic specification the library
|
| 78 |
+
implements, e.g. "blas" is a specification with different implementations.
|
| 79 |
+
- internal_api : str
|
| 80 |
+
Usually the name of the library or concrete implementation of some
|
| 81 |
+
specification, e.g. "openblas" is an implementation of the "blas"
|
| 82 |
+
specification.
|
| 83 |
+
- filename_prefixes : tuple
|
| 84 |
+
Possible prefixes of the shared library's filename that allow to
|
| 85 |
+
identify the library. e.g. "libopenblas" for libopenblas.so.
|
| 86 |
+
|
| 87 |
+
and implement the following methods: `get_num_threads`, `set_num_threads` and
|
| 88 |
+
`get_version`.
|
| 89 |
+
|
| 90 |
+
Threadpoolctl loops through all the loaded shared libraries and tries to match
|
| 91 |
+
the filename of each library with the `filename_prefixes`. If a match is found, a
|
| 92 |
+
controller is instantiated and a handler to the library is stored in the `dynlib`
|
| 93 |
+
attribute as a `ctypes.CDLL` object. It can be used to access the necessary symbols
|
| 94 |
+
of the shared library to implement the above methods.
|
| 95 |
+
|
| 96 |
+
The following information will be exposed in the info dictionary:
|
| 97 |
+
- user_api : standardized API, if any, or a copy of internal_api.
|
| 98 |
+
- internal_api : implementation-specific API.
|
| 99 |
+
- num_threads : the current thread limit.
|
| 100 |
+
- prefix : prefix of the shared library's filename.
|
| 101 |
+
- filepath : path to the loaded shared library.
|
| 102 |
+
- version : version of the library (if available).
|
| 103 |
+
|
| 104 |
+
In addition, each library controller may expose internal API specific entries. They
|
| 105 |
+
must be set as attributes in the `set_additional_attributes` method.
|
| 106 |
+
"""
|
| 107 |
+
|
| 108 |
+
@final
|
| 109 |
+
def __init__(self, *, filepath=None, prefix=None, parent=None):
|
| 110 |
+
"""This is not meant to be overriden by subclasses."""
|
| 111 |
+
self.parent = parent
|
| 112 |
+
self.prefix = prefix
|
| 113 |
+
self.filepath = filepath
|
| 114 |
+
self.dynlib = ctypes.CDLL(filepath, mode=_RTLD_NOLOAD)
|
| 115 |
+
self._symbol_prefix, self._symbol_suffix = self._find_affixes()
|
| 116 |
+
self.version = self.get_version()
|
| 117 |
+
self.set_additional_attributes()
|
| 118 |
+
|
| 119 |
+
def info(self):
|
| 120 |
+
"""Return relevant info wrapped in a dict"""
|
| 121 |
+
hidden_attrs = ("dynlib", "parent", "_symbol_prefix", "_symbol_suffix")
|
| 122 |
+
return {
|
| 123 |
+
"user_api": self.user_api,
|
| 124 |
+
"internal_api": self.internal_api,
|
| 125 |
+
"num_threads": self.num_threads,
|
| 126 |
+
**{k: v for k, v in vars(self).items() if k not in hidden_attrs},
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
def set_additional_attributes(self):
|
| 130 |
+
"""Set additional attributes meant to be exposed in the info dict"""
|
| 131 |
+
|
| 132 |
+
@property
|
| 133 |
+
def num_threads(self):
|
| 134 |
+
"""Exposes the current thread limit as a dynamic property
|
| 135 |
+
|
| 136 |
+
This is not meant to be used or overriden by subclasses.
|
| 137 |
+
"""
|
| 138 |
+
return self.get_num_threads()
|
| 139 |
+
|
| 140 |
+
@abstractmethod
|
| 141 |
+
def get_num_threads(self):
|
| 142 |
+
"""Return the maximum number of threads available to use"""
|
| 143 |
+
|
| 144 |
+
@abstractmethod
|
| 145 |
+
def set_num_threads(self, num_threads):
|
| 146 |
+
"""Set the maximum number of threads to use"""
|
| 147 |
+
|
| 148 |
+
@abstractmethod
|
| 149 |
+
def get_version(self):
|
| 150 |
+
"""Return the version of the shared library"""
|
| 151 |
+
|
| 152 |
+
def _find_affixes(self):
|
| 153 |
+
"""Return the affixes for the symbols of the shared library"""
|
| 154 |
+
return "", ""
|
| 155 |
+
|
| 156 |
+
def _get_symbol(self, name):
|
| 157 |
+
"""Return the symbol of the shared library accounding for the affixes"""
|
| 158 |
+
return getattr(
|
| 159 |
+
self.dynlib, f"{self._symbol_prefix}{name}{self._symbol_suffix}", None
|
| 160 |
+
)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
class OpenBLASController(LibController):
|
| 164 |
+
"""Controller class for OpenBLAS"""
|
| 165 |
+
|
| 166 |
+
user_api = "blas"
|
| 167 |
+
internal_api = "openblas"
|
| 168 |
+
filename_prefixes = ("libopenblas", "libblas", "libscipy_openblas")
|
| 169 |
+
|
| 170 |
+
_symbol_prefixes = ("", "scipy_")
|
| 171 |
+
_symbol_suffixes = ("", "64_", "_64")
|
| 172 |
+
|
| 173 |
+
# All variations of "openblas_get_num_threads", accounting for the affixes
|
| 174 |
+
check_symbols = tuple(
|
| 175 |
+
f"{prefix}openblas_get_num_threads{suffix}"
|
| 176 |
+
for prefix, suffix in itertools.product(_symbol_prefixes, _symbol_suffixes)
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
def _find_affixes(self):
|
| 180 |
+
for prefix, suffix in itertools.product(
|
| 181 |
+
self._symbol_prefixes, self._symbol_suffixes
|
| 182 |
+
):
|
| 183 |
+
if hasattr(self.dynlib, f"{prefix}openblas_get_num_threads{suffix}"):
|
| 184 |
+
return prefix, suffix
|
| 185 |
+
|
| 186 |
+
def set_additional_attributes(self):
|
| 187 |
+
self.threading_layer = self._get_threading_layer()
|
| 188 |
+
self.architecture = self._get_architecture()
|
| 189 |
+
|
| 190 |
+
def get_num_threads(self):
|
| 191 |
+
get_num_threads_func = self._get_symbol("openblas_get_num_threads")
|
| 192 |
+
if get_num_threads_func is not None:
|
| 193 |
+
return get_num_threads_func()
|
| 194 |
+
return None
|
| 195 |
+
|
| 196 |
+
def set_num_threads(self, num_threads):
|
| 197 |
+
set_num_threads_func = self._get_symbol("openblas_set_num_threads")
|
| 198 |
+
if set_num_threads_func is not None:
|
| 199 |
+
return set_num_threads_func(num_threads)
|
| 200 |
+
return None
|
| 201 |
+
|
| 202 |
+
def get_version(self):
|
| 203 |
+
# None means OpenBLAS is not loaded or version < 0.3.4, since OpenBLAS
|
| 204 |
+
# did not expose its version before that.
|
| 205 |
+
get_version_func = self._get_symbol("openblas_get_config")
|
| 206 |
+
if get_version_func is not None:
|
| 207 |
+
get_version_func.restype = ctypes.c_char_p
|
| 208 |
+
config = get_version_func().split()
|
| 209 |
+
if config[0] == b"OpenBLAS":
|
| 210 |
+
return config[1].decode("utf-8")
|
| 211 |
+
return None
|
| 212 |
+
return None
|
| 213 |
+
|
| 214 |
+
def _get_threading_layer(self):
|
| 215 |
+
"""Return the threading layer of OpenBLAS"""
|
| 216 |
+
get_threading_layer_func = self._get_symbol("openblas_get_parallel")
|
| 217 |
+
if get_threading_layer_func is not None:
|
| 218 |
+
threading_layer = get_threading_layer_func()
|
| 219 |
+
if threading_layer == 2:
|
| 220 |
+
return "openmp"
|
| 221 |
+
elif threading_layer == 1:
|
| 222 |
+
return "pthreads"
|
| 223 |
+
return "disabled"
|
| 224 |
+
return "unknown"
|
| 225 |
+
|
| 226 |
+
def _get_architecture(self):
|
| 227 |
+
"""Return the architecture detected by OpenBLAS"""
|
| 228 |
+
get_architecture_func = self._get_symbol("openblas_get_corename")
|
| 229 |
+
if get_architecture_func is not None:
|
| 230 |
+
get_architecture_func.restype = ctypes.c_char_p
|
| 231 |
+
return get_architecture_func().decode("utf-8")
|
| 232 |
+
return None
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
class BLISController(LibController):
|
| 236 |
+
"""Controller class for BLIS"""
|
| 237 |
+
|
| 238 |
+
user_api = "blas"
|
| 239 |
+
internal_api = "blis"
|
| 240 |
+
filename_prefixes = ("libblis", "libblas")
|
| 241 |
+
check_symbols = (
|
| 242 |
+
"bli_thread_get_num_threads",
|
| 243 |
+
"bli_thread_set_num_threads",
|
| 244 |
+
"bli_info_get_version_str",
|
| 245 |
+
"bli_info_get_enable_openmp",
|
| 246 |
+
"bli_info_get_enable_pthreads",
|
| 247 |
+
"bli_arch_query_id",
|
| 248 |
+
"bli_arch_string",
|
| 249 |
+
)
|
| 250 |
+
|
| 251 |
+
def set_additional_attributes(self):
|
| 252 |
+
self.threading_layer = self._get_threading_layer()
|
| 253 |
+
self.architecture = self._get_architecture()
|
| 254 |
+
|
| 255 |
+
def get_num_threads(self):
|
| 256 |
+
get_func = getattr(self.dynlib, "bli_thread_get_num_threads", lambda: None)
|
| 257 |
+
num_threads = get_func()
|
| 258 |
+
# by default BLIS is single-threaded and get_num_threads
|
| 259 |
+
# returns -1. We map it to 1 for consistency with other libraries.
|
| 260 |
+
return 1 if num_threads == -1 else num_threads
|
| 261 |
+
|
| 262 |
+
def set_num_threads(self, num_threads):
|
| 263 |
+
set_func = getattr(
|
| 264 |
+
self.dynlib, "bli_thread_set_num_threads", lambda num_threads: None
|
| 265 |
+
)
|
| 266 |
+
return set_func(num_threads)
|
| 267 |
+
|
| 268 |
+
def get_version(self):
|
| 269 |
+
get_version_ = getattr(self.dynlib, "bli_info_get_version_str", None)
|
| 270 |
+
if get_version_ is None:
|
| 271 |
+
return None
|
| 272 |
+
|
| 273 |
+
get_version_.restype = ctypes.c_char_p
|
| 274 |
+
return get_version_().decode("utf-8")
|
| 275 |
+
|
| 276 |
+
def _get_threading_layer(self):
|
| 277 |
+
"""Return the threading layer of BLIS"""
|
| 278 |
+
if getattr(self.dynlib, "bli_info_get_enable_openmp", lambda: False)():
|
| 279 |
+
return "openmp"
|
| 280 |
+
elif getattr(self.dynlib, "bli_info_get_enable_pthreads", lambda: False)():
|
| 281 |
+
return "pthreads"
|
| 282 |
+
return "disabled"
|
| 283 |
+
|
| 284 |
+
def _get_architecture(self):
|
| 285 |
+
"""Return the architecture detected by BLIS"""
|
| 286 |
+
bli_arch_query_id = getattr(self.dynlib, "bli_arch_query_id", None)
|
| 287 |
+
bli_arch_string = getattr(self.dynlib, "bli_arch_string", None)
|
| 288 |
+
if bli_arch_query_id is None or bli_arch_string is None:
|
| 289 |
+
return None
|
| 290 |
+
|
| 291 |
+
# the true restype should be BLIS' arch_t (enum) but int should work
|
| 292 |
+
# for us:
|
| 293 |
+
bli_arch_query_id.restype = ctypes.c_int
|
| 294 |
+
bli_arch_string.restype = ctypes.c_char_p
|
| 295 |
+
return bli_arch_string(bli_arch_query_id()).decode("utf-8")
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
class FlexiBLASController(LibController):
|
| 299 |
+
"""Controller class for FlexiBLAS"""
|
| 300 |
+
|
| 301 |
+
user_api = "blas"
|
| 302 |
+
internal_api = "flexiblas"
|
| 303 |
+
filename_prefixes = ("libflexiblas",)
|
| 304 |
+
check_symbols = (
|
| 305 |
+
"flexiblas_get_num_threads",
|
| 306 |
+
"flexiblas_set_num_threads",
|
| 307 |
+
"flexiblas_get_version",
|
| 308 |
+
"flexiblas_list",
|
| 309 |
+
"flexiblas_list_loaded",
|
| 310 |
+
"flexiblas_current_backend",
|
| 311 |
+
)
|
| 312 |
+
|
| 313 |
+
@property
|
| 314 |
+
def loaded_backends(self):
|
| 315 |
+
return self._get_backend_list(loaded=True)
|
| 316 |
+
|
| 317 |
+
@property
|
| 318 |
+
def current_backend(self):
|
| 319 |
+
return self._get_current_backend()
|
| 320 |
+
|
| 321 |
+
def info(self):
|
| 322 |
+
"""Return relevant info wrapped in a dict"""
|
| 323 |
+
# We override the info method because the loaded and current backends
|
| 324 |
+
# are dynamic properties
|
| 325 |
+
exposed_attrs = super().info()
|
| 326 |
+
exposed_attrs["loaded_backends"] = self.loaded_backends
|
| 327 |
+
exposed_attrs["current_backend"] = self.current_backend
|
| 328 |
+
|
| 329 |
+
return exposed_attrs
|
| 330 |
+
|
| 331 |
+
def set_additional_attributes(self):
|
| 332 |
+
self.available_backends = self._get_backend_list(loaded=False)
|
| 333 |
+
|
| 334 |
+
def get_num_threads(self):
|
| 335 |
+
get_func = getattr(self.dynlib, "flexiblas_get_num_threads", lambda: None)
|
| 336 |
+
num_threads = get_func()
|
| 337 |
+
# by default BLIS is single-threaded and get_num_threads
|
| 338 |
+
# returns -1. We map it to 1 for consistency with other libraries.
|
| 339 |
+
return 1 if num_threads == -1 else num_threads
|
| 340 |
+
|
| 341 |
+
def set_num_threads(self, num_threads):
|
| 342 |
+
set_func = getattr(
|
| 343 |
+
self.dynlib, "flexiblas_set_num_threads", lambda num_threads: None
|
| 344 |
+
)
|
| 345 |
+
return set_func(num_threads)
|
| 346 |
+
|
| 347 |
+
def get_version(self):
|
| 348 |
+
get_version_ = getattr(self.dynlib, "flexiblas_get_version", None)
|
| 349 |
+
if get_version_ is None:
|
| 350 |
+
return None
|
| 351 |
+
|
| 352 |
+
major = ctypes.c_int()
|
| 353 |
+
minor = ctypes.c_int()
|
| 354 |
+
patch = ctypes.c_int()
|
| 355 |
+
get_version_(ctypes.byref(major), ctypes.byref(minor), ctypes.byref(patch))
|
| 356 |
+
return f"{major.value}.{minor.value}.{patch.value}"
|
| 357 |
+
|
| 358 |
+
def _get_backend_list(self, loaded=False):
|
| 359 |
+
"""Return the list of available backends for FlexiBLAS.
|
| 360 |
+
|
| 361 |
+
If loaded is False, return the list of available backends from the FlexiBLAS
|
| 362 |
+
configuration. If loaded is True, return the list of actually loaded backends.
|
| 363 |
+
"""
|
| 364 |
+
func_name = f"flexiblas_list{'_loaded' if loaded else ''}"
|
| 365 |
+
get_backend_list_ = getattr(self.dynlib, func_name, None)
|
| 366 |
+
if get_backend_list_ is None:
|
| 367 |
+
return None
|
| 368 |
+
|
| 369 |
+
n_backends = get_backend_list_(None, 0, 0)
|
| 370 |
+
|
| 371 |
+
backends = []
|
| 372 |
+
for i in range(n_backends):
|
| 373 |
+
backend_name = ctypes.create_string_buffer(1024)
|
| 374 |
+
get_backend_list_(backend_name, 1024, i)
|
| 375 |
+
if backend_name.value.decode("utf-8") != "__FALLBACK__":
|
| 376 |
+
# We don't know when to expect __FALLBACK__ but it is not a real
|
| 377 |
+
# backend and does not show up when running flexiblas list.
|
| 378 |
+
backends.append(backend_name.value.decode("utf-8"))
|
| 379 |
+
return backends
|
| 380 |
+
|
| 381 |
+
def _get_current_backend(self):
|
| 382 |
+
"""Return the backend of FlexiBLAS"""
|
| 383 |
+
get_backend_ = getattr(self.dynlib, "flexiblas_current_backend", None)
|
| 384 |
+
if get_backend_ is None:
|
| 385 |
+
return None
|
| 386 |
+
|
| 387 |
+
backend = ctypes.create_string_buffer(1024)
|
| 388 |
+
get_backend_(backend, ctypes.sizeof(backend))
|
| 389 |
+
return backend.value.decode("utf-8")
|
| 390 |
+
|
| 391 |
+
def switch_backend(self, backend):
|
| 392 |
+
"""Switch the backend of FlexiBLAS
|
| 393 |
+
|
| 394 |
+
Parameters
|
| 395 |
+
----------
|
| 396 |
+
backend : str
|
| 397 |
+
The name or the path to the shared library of the backend to switch to. If
|
| 398 |
+
the backend is not already loaded, it will be loaded first.
|
| 399 |
+
"""
|
| 400 |
+
if backend not in self.loaded_backends:
|
| 401 |
+
if backend in self.available_backends:
|
| 402 |
+
load_func = getattr(self.dynlib, "flexiblas_load_backend", lambda _: -1)
|
| 403 |
+
else: # assume backend is a path to a shared library
|
| 404 |
+
load_func = getattr(
|
| 405 |
+
self.dynlib, "flexiblas_load_backend_library", lambda _: -1
|
| 406 |
+
)
|
| 407 |
+
res = load_func(str(backend).encode("utf-8"))
|
| 408 |
+
if res == -1:
|
| 409 |
+
raise RuntimeError(
|
| 410 |
+
f"Failed to load backend {backend!r}. It must either be the name of"
|
| 411 |
+
" a backend available in the FlexiBLAS configuration "
|
| 412 |
+
f"{self.available_backends} or the path to a valid shared library."
|
| 413 |
+
)
|
| 414 |
+
|
| 415 |
+
# Trigger a new search of loaded shared libraries since loading a new
|
| 416 |
+
# backend caused a dlopen.
|
| 417 |
+
self.parent._load_libraries()
|
| 418 |
+
|
| 419 |
+
switch_func = getattr(self.dynlib, "flexiblas_switch", lambda _: -1)
|
| 420 |
+
idx = self.loaded_backends.index(backend)
|
| 421 |
+
res = switch_func(idx)
|
| 422 |
+
if res == -1:
|
| 423 |
+
raise RuntimeError(f"Failed to switch to backend {backend!r}.")
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
class MKLController(LibController):
|
| 427 |
+
"""Controller class for MKL"""
|
| 428 |
+
|
| 429 |
+
user_api = "blas"
|
| 430 |
+
internal_api = "mkl"
|
| 431 |
+
filename_prefixes = ("libmkl_rt", "mkl_rt", "libblas")
|
| 432 |
+
check_symbols = (
|
| 433 |
+
"MKL_Get_Max_Threads",
|
| 434 |
+
"MKL_Set_Num_Threads",
|
| 435 |
+
"MKL_Get_Version_String",
|
| 436 |
+
"MKL_Set_Threading_Layer",
|
| 437 |
+
)
|
| 438 |
+
|
| 439 |
+
def set_additional_attributes(self):
|
| 440 |
+
self.threading_layer = self._get_threading_layer()
|
| 441 |
+
|
| 442 |
+
def get_num_threads(self):
|
| 443 |
+
get_func = getattr(self.dynlib, "MKL_Get_Max_Threads", lambda: None)
|
| 444 |
+
return get_func()
|
| 445 |
+
|
| 446 |
+
def set_num_threads(self, num_threads):
|
| 447 |
+
set_func = getattr(self.dynlib, "MKL_Set_Num_Threads", lambda num_threads: None)
|
| 448 |
+
return set_func(num_threads)
|
| 449 |
+
|
| 450 |
+
def get_version(self):
|
| 451 |
+
if not hasattr(self.dynlib, "MKL_Get_Version_String"):
|
| 452 |
+
return None
|
| 453 |
+
|
| 454 |
+
res = ctypes.create_string_buffer(200)
|
| 455 |
+
self.dynlib.MKL_Get_Version_String(res, 200)
|
| 456 |
+
|
| 457 |
+
version = res.value.decode("utf-8")
|
| 458 |
+
group = re.search(r"Version ([^ ]+) ", version)
|
| 459 |
+
if group is not None:
|
| 460 |
+
version = group.groups()[0]
|
| 461 |
+
return version.strip()
|
| 462 |
+
|
| 463 |
+
def _get_threading_layer(self):
|
| 464 |
+
"""Return the threading layer of MKL"""
|
| 465 |
+
# The function mkl_set_threading_layer returns the current threading
|
| 466 |
+
# layer. Calling it with an invalid threading layer allows us to safely
|
| 467 |
+
# get the threading layer
|
| 468 |
+
set_threading_layer = getattr(
|
| 469 |
+
self.dynlib, "MKL_Set_Threading_Layer", lambda layer: -1
|
| 470 |
+
)
|
| 471 |
+
layer_map = {
|
| 472 |
+
0: "intel",
|
| 473 |
+
1: "sequential",
|
| 474 |
+
2: "pgi",
|
| 475 |
+
3: "gnu",
|
| 476 |
+
4: "tbb",
|
| 477 |
+
-1: "not specified",
|
| 478 |
+
}
|
| 479 |
+
return layer_map[set_threading_layer(-1)]
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
class OpenMPController(LibController):
|
| 483 |
+
"""Controller class for OpenMP"""
|
| 484 |
+
|
| 485 |
+
user_api = "openmp"
|
| 486 |
+
internal_api = "openmp"
|
| 487 |
+
filename_prefixes = ("libiomp", "libgomp", "libomp", "vcomp")
|
| 488 |
+
check_symbols = (
|
| 489 |
+
"omp_get_max_threads",
|
| 490 |
+
"omp_get_num_threads",
|
| 491 |
+
)
|
| 492 |
+
|
| 493 |
+
def get_num_threads(self):
|
| 494 |
+
get_func = getattr(self.dynlib, "omp_get_max_threads", lambda: None)
|
| 495 |
+
return get_func()
|
| 496 |
+
|
| 497 |
+
def set_num_threads(self, num_threads):
|
| 498 |
+
set_func = getattr(self.dynlib, "omp_set_num_threads", lambda num_threads: None)
|
| 499 |
+
return set_func(num_threads)
|
| 500 |
+
|
| 501 |
+
def get_version(self):
|
| 502 |
+
# There is no way to get the version number programmatically in OpenMP.
|
| 503 |
+
return None
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
# Controllers for the libraries that we'll look for in the loaded libraries.
|
| 507 |
+
# Third party libraries can register their own controllers.
|
| 508 |
+
_ALL_CONTROLLERS = [
|
| 509 |
+
OpenBLASController,
|
| 510 |
+
BLISController,
|
| 511 |
+
MKLController,
|
| 512 |
+
OpenMPController,
|
| 513 |
+
FlexiBLASController,
|
| 514 |
+
]
|
| 515 |
+
|
| 516 |
+
# Helpers for the doc and test names
|
| 517 |
+
_ALL_USER_APIS = list(set(lib.user_api for lib in _ALL_CONTROLLERS))
|
| 518 |
+
_ALL_INTERNAL_APIS = [lib.internal_api for lib in _ALL_CONTROLLERS]
|
| 519 |
+
_ALL_PREFIXES = list(
|
| 520 |
+
set(prefix for lib in _ALL_CONTROLLERS for prefix in lib.filename_prefixes)
|
| 521 |
+
)
|
| 522 |
+
_ALL_BLAS_LIBRARIES = [
|
| 523 |
+
lib.internal_api for lib in _ALL_CONTROLLERS if lib.user_api == "blas"
|
| 524 |
+
]
|
| 525 |
+
_ALL_OPENMP_LIBRARIES = OpenMPController.filename_prefixes
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
def register(controller):
|
| 529 |
+
"""Register a new controller"""
|
| 530 |
+
_ALL_CONTROLLERS.append(controller)
|
| 531 |
+
_ALL_USER_APIS.append(controller.user_api)
|
| 532 |
+
_ALL_INTERNAL_APIS.append(controller.internal_api)
|
| 533 |
+
_ALL_PREFIXES.extend(controller.filename_prefixes)
|
| 534 |
+
|
| 535 |
+
|
| 536 |
+
def _format_docstring(*args, **kwargs):
|
| 537 |
+
def decorator(o):
|
| 538 |
+
if o.__doc__ is not None:
|
| 539 |
+
o.__doc__ = o.__doc__.format(*args, **kwargs)
|
| 540 |
+
return o
|
| 541 |
+
|
| 542 |
+
return decorator
|
| 543 |
+
|
| 544 |
+
|
| 545 |
+
@lru_cache(maxsize=10000)
|
| 546 |
+
def _realpath(filepath):
|
| 547 |
+
"""Small caching wrapper around os.path.realpath to limit system calls"""
|
| 548 |
+
return os.path.realpath(filepath)
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
@_format_docstring(USER_APIS=list(_ALL_USER_APIS), INTERNAL_APIS=_ALL_INTERNAL_APIS)
|
| 552 |
+
def threadpool_info():
|
| 553 |
+
"""Return the maximal number of threads for each detected library.
|
| 554 |
+
|
| 555 |
+
Return a list with all the supported libraries that have been found. Each
|
| 556 |
+
library is represented by a dict with the following information:
|
| 557 |
+
|
| 558 |
+
- "user_api" : user API. Possible values are {USER_APIS}.
|
| 559 |
+
- "internal_api": internal API. Possible values are {INTERNAL_APIS}.
|
| 560 |
+
- "prefix" : filename prefix of the specific implementation.
|
| 561 |
+
- "filepath": path to the loaded library.
|
| 562 |
+
- "version": version of the library (if available).
|
| 563 |
+
- "num_threads": the current thread limit.
|
| 564 |
+
|
| 565 |
+
In addition, each library may contain internal_api specific entries.
|
| 566 |
+
"""
|
| 567 |
+
return ThreadpoolController().info()
|
| 568 |
+
|
| 569 |
+
|
| 570 |
+
class _ThreadpoolLimiter:
|
| 571 |
+
"""The guts of ThreadpoolController.limit
|
| 572 |
+
|
| 573 |
+
Refer to the docstring of ThreadpoolController.limit for more details.
|
| 574 |
+
|
| 575 |
+
It will only act on the library controllers held by the provided `controller`.
|
| 576 |
+
Using the default constructor sets the limits right away such that it can be used as
|
| 577 |
+
a callable. Setting the limits can be delayed by using the `wrap` class method such
|
| 578 |
+
that it can be used as a decorator.
|
| 579 |
+
"""
|
| 580 |
+
|
| 581 |
+
def __init__(self, controller, *, limits=None, user_api=None):
|
| 582 |
+
self._controller = controller
|
| 583 |
+
self._limits, self._user_api, self._prefixes = self._check_params(
|
| 584 |
+
limits, user_api
|
| 585 |
+
)
|
| 586 |
+
self._original_info = self._controller.info()
|
| 587 |
+
self._set_threadpool_limits()
|
| 588 |
+
|
| 589 |
+
def __enter__(self):
|
| 590 |
+
return self
|
| 591 |
+
|
| 592 |
+
def __exit__(self, type, value, traceback):
|
| 593 |
+
self.restore_original_limits()
|
| 594 |
+
|
| 595 |
+
@classmethod
|
| 596 |
+
def wrap(cls, controller, *, limits=None, user_api=None):
|
| 597 |
+
"""Return an instance of this class that can be used as a decorator"""
|
| 598 |
+
return _ThreadpoolLimiterDecorator(
|
| 599 |
+
controller=controller, limits=limits, user_api=user_api
|
| 600 |
+
)
|
| 601 |
+
|
| 602 |
+
def restore_original_limits(self):
|
| 603 |
+
"""Set the limits back to their original values"""
|
| 604 |
+
for lib_controller, original_info in zip(
|
| 605 |
+
self._controller.lib_controllers, self._original_info
|
| 606 |
+
):
|
| 607 |
+
lib_controller.set_num_threads(original_info["num_threads"])
|
| 608 |
+
|
| 609 |
+
# Alias of `restore_original_limits` for backward compatibility
|
| 610 |
+
unregister = restore_original_limits
|
| 611 |
+
|
| 612 |
+
def get_original_num_threads(self):
|
| 613 |
+
"""Original num_threads from before calling threadpool_limits
|
| 614 |
+
|
| 615 |
+
Return a dict `{user_api: num_threads}`.
|
| 616 |
+
"""
|
| 617 |
+
num_threads = {}
|
| 618 |
+
warning_apis = []
|
| 619 |
+
|
| 620 |
+
for user_api in self._user_api:
|
| 621 |
+
limits = [
|
| 622 |
+
lib_info["num_threads"]
|
| 623 |
+
for lib_info in self._original_info
|
| 624 |
+
if lib_info["user_api"] == user_api
|
| 625 |
+
]
|
| 626 |
+
limits = set(limits)
|
| 627 |
+
n_limits = len(limits)
|
| 628 |
+
|
| 629 |
+
if n_limits == 1:
|
| 630 |
+
limit = limits.pop()
|
| 631 |
+
elif n_limits == 0:
|
| 632 |
+
limit = None
|
| 633 |
+
else:
|
| 634 |
+
limit = min(limits)
|
| 635 |
+
warning_apis.append(user_api)
|
| 636 |
+
|
| 637 |
+
num_threads[user_api] = limit
|
| 638 |
+
|
| 639 |
+
if warning_apis:
|
| 640 |
+
warnings.warn(
|
| 641 |
+
"Multiple value possible for following user apis: "
|
| 642 |
+
+ ", ".join(warning_apis)
|
| 643 |
+
+ ". Returning the minimum."
|
| 644 |
+
)
|
| 645 |
+
|
| 646 |
+
return num_threads
|
| 647 |
+
|
| 648 |
+
def _check_params(self, limits, user_api):
|
| 649 |
+
"""Suitable values for the _limits, _user_api and _prefixes attributes"""
|
| 650 |
+
|
| 651 |
+
if isinstance(limits, str) and limits == "sequential_blas_under_openmp":
|
| 652 |
+
(
|
| 653 |
+
limits,
|
| 654 |
+
user_api,
|
| 655 |
+
) = self._controller._get_params_for_sequential_blas_under_openmp().values()
|
| 656 |
+
|
| 657 |
+
if limits is None or isinstance(limits, int):
|
| 658 |
+
if user_api is None:
|
| 659 |
+
user_api = _ALL_USER_APIS
|
| 660 |
+
elif user_api in _ALL_USER_APIS:
|
| 661 |
+
user_api = [user_api]
|
| 662 |
+
else:
|
| 663 |
+
raise ValueError(
|
| 664 |
+
f"user_api must be either in {_ALL_USER_APIS} or None. Got "
|
| 665 |
+
f"{user_api} instead."
|
| 666 |
+
)
|
| 667 |
+
|
| 668 |
+
if limits is not None:
|
| 669 |
+
limits = {api: limits for api in user_api}
|
| 670 |
+
prefixes = []
|
| 671 |
+
else:
|
| 672 |
+
if isinstance(limits, list):
|
| 673 |
+
# This should be a list of dicts of library info, for
|
| 674 |
+
# compatibility with the result from threadpool_info.
|
| 675 |
+
limits = {
|
| 676 |
+
lib_info["prefix"]: lib_info["num_threads"] for lib_info in limits
|
| 677 |
+
}
|
| 678 |
+
elif isinstance(limits, ThreadpoolController):
|
| 679 |
+
# To set the limits from the library controllers of a
|
| 680 |
+
# ThreadpoolController object.
|
| 681 |
+
limits = {
|
| 682 |
+
lib_controller.prefix: lib_controller.num_threads
|
| 683 |
+
for lib_controller in limits.lib_controllers
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
if not isinstance(limits, dict):
|
| 687 |
+
raise TypeError(
|
| 688 |
+
"limits must either be an int, a list, a dict, or "
|
| 689 |
+
f"'sequential_blas_under_openmp'. Got {type(limits)} instead"
|
| 690 |
+
)
|
| 691 |
+
|
| 692 |
+
# With a dictionary, can set both specific limit for given
|
| 693 |
+
# libraries and global limit for user_api. Fetch each separately.
|
| 694 |
+
prefixes = [prefix for prefix in limits if prefix in _ALL_PREFIXES]
|
| 695 |
+
user_api = [api for api in limits if api in _ALL_USER_APIS]
|
| 696 |
+
|
| 697 |
+
return limits, user_api, prefixes
|
| 698 |
+
|
| 699 |
+
def _set_threadpool_limits(self):
|
| 700 |
+
"""Change the maximal number of threads in selected thread pools.
|
| 701 |
+
|
| 702 |
+
Return a list with all the supported libraries that have been found
|
| 703 |
+
matching `self._prefixes` and `self._user_api`.
|
| 704 |
+
"""
|
| 705 |
+
if self._limits is None:
|
| 706 |
+
return
|
| 707 |
+
|
| 708 |
+
for lib_controller in self._controller.lib_controllers:
|
| 709 |
+
# self._limits is a dict {key: num_threads} where key is either
|
| 710 |
+
# a prefix or a user_api. If a library matches both, the limit
|
| 711 |
+
# corresponding to the prefix is chosen.
|
| 712 |
+
if lib_controller.prefix in self._limits:
|
| 713 |
+
num_threads = self._limits[lib_controller.prefix]
|
| 714 |
+
elif lib_controller.user_api in self._limits:
|
| 715 |
+
num_threads = self._limits[lib_controller.user_api]
|
| 716 |
+
else:
|
| 717 |
+
continue
|
| 718 |
+
|
| 719 |
+
if num_threads is not None:
|
| 720 |
+
lib_controller.set_num_threads(num_threads)
|
| 721 |
+
|
| 722 |
+
|
| 723 |
+
class _ThreadpoolLimiterDecorator(_ThreadpoolLimiter, ContextDecorator):
|
| 724 |
+
"""Same as _ThreadpoolLimiter but to be used as a decorator"""
|
| 725 |
+
|
| 726 |
+
def __init__(self, controller, *, limits=None, user_api=None):
|
| 727 |
+
self._limits, self._user_api, self._prefixes = self._check_params(
|
| 728 |
+
limits, user_api
|
| 729 |
+
)
|
| 730 |
+
self._controller = controller
|
| 731 |
+
|
| 732 |
+
def __enter__(self):
|
| 733 |
+
# we need to set the limits here and not in the __init__ because we want the
|
| 734 |
+
# limits to be set when calling the decorated function, not when creating the
|
| 735 |
+
# decorator.
|
| 736 |
+
self._original_info = self._controller.info()
|
| 737 |
+
self._set_threadpool_limits()
|
| 738 |
+
return self
|
| 739 |
+
|
| 740 |
+
|
| 741 |
+
@_format_docstring(
|
| 742 |
+
USER_APIS=", ".join(f'"{api}"' for api in _ALL_USER_APIS),
|
| 743 |
+
BLAS_LIBS=", ".join(_ALL_BLAS_LIBRARIES),
|
| 744 |
+
OPENMP_LIBS=", ".join(_ALL_OPENMP_LIBRARIES),
|
| 745 |
+
)
|
| 746 |
+
class threadpool_limits(_ThreadpoolLimiter):
|
| 747 |
+
"""Change the maximal number of threads that can be used in thread pools.
|
| 748 |
+
|
| 749 |
+
This object can be used either as a callable (the construction of this object
|
| 750 |
+
limits the number of threads), as a context manager in a `with` block to
|
| 751 |
+
automatically restore the original state of the controlled libraries when exiting
|
| 752 |
+
the block, or as a decorator through its `wrap` method.
|
| 753 |
+
|
| 754 |
+
Set the maximal number of threads that can be used in thread pools used in
|
| 755 |
+
the supported libraries to `limit`. This function works for libraries that
|
| 756 |
+
are already loaded in the interpreter and can be changed dynamically.
|
| 757 |
+
|
| 758 |
+
This effect is global and impacts the whole Python process. There is no thread level
|
| 759 |
+
isolation as these libraries do not offer thread-local APIs to configure the number
|
| 760 |
+
of threads to use in nested parallel calls.
|
| 761 |
+
|
| 762 |
+
Parameters
|
| 763 |
+
----------
|
| 764 |
+
limits : int, dict, 'sequential_blas_under_openmp' or None (default=None)
|
| 765 |
+
The maximal number of threads that can be used in thread pools
|
| 766 |
+
|
| 767 |
+
- If int, sets the maximum number of threads to `limits` for each
|
| 768 |
+
library selected by `user_api`.
|
| 769 |
+
|
| 770 |
+
- If it is a dictionary `{{key: max_threads}}`, this function sets a
|
| 771 |
+
custom maximum number of threads for each `key` which can be either a
|
| 772 |
+
`user_api` or a `prefix` for a specific library.
|
| 773 |
+
|
| 774 |
+
- If 'sequential_blas_under_openmp', it will chose the appropriate `limits`
|
| 775 |
+
and `user_api` parameters for the specific use case of sequential BLAS
|
| 776 |
+
calls within an OpenMP parallel region. The `user_api` parameter is
|
| 777 |
+
ignored.
|
| 778 |
+
|
| 779 |
+
- If None, this function does not do anything.
|
| 780 |
+
|
| 781 |
+
user_api : {USER_APIS} or None (default=None)
|
| 782 |
+
APIs of libraries to limit. Used only if `limits` is an int.
|
| 783 |
+
|
| 784 |
+
- If "blas", it will only limit BLAS supported libraries ({BLAS_LIBS}).
|
| 785 |
+
|
| 786 |
+
- If "openmp", it will only limit OpenMP supported libraries
|
| 787 |
+
({OPENMP_LIBS}). Note that it can affect the number of threads used
|
| 788 |
+
by the BLAS libraries if they rely on OpenMP.
|
| 789 |
+
|
| 790 |
+
- If None, this function will apply to all supported libraries.
|
| 791 |
+
"""
|
| 792 |
+
|
| 793 |
+
def __init__(self, limits=None, user_api=None):
|
| 794 |
+
super().__init__(ThreadpoolController(), limits=limits, user_api=user_api)
|
| 795 |
+
|
| 796 |
+
@classmethod
|
| 797 |
+
def wrap(cls, limits=None, user_api=None):
|
| 798 |
+
return super().wrap(ThreadpoolController(), limits=limits, user_api=user_api)
|
| 799 |
+
|
| 800 |
+
|
| 801 |
+
class ThreadpoolController:
|
| 802 |
+
"""Collection of LibController objects for all loaded supported libraries
|
| 803 |
+
|
| 804 |
+
Attributes
|
| 805 |
+
----------
|
| 806 |
+
lib_controllers : list of `LibController` objects
|
| 807 |
+
The list of library controllers of all loaded supported libraries.
|
| 808 |
+
"""
|
| 809 |
+
|
| 810 |
+
# Cache for libc under POSIX and a few system libraries under Windows.
|
| 811 |
+
# We use a class level cache instead of an instance level cache because
|
| 812 |
+
# it's very unlikely that a shared library will be unloaded and reloaded
|
| 813 |
+
# during the lifetime of a program.
|
| 814 |
+
_system_libraries = dict()
|
| 815 |
+
|
| 816 |
+
def __init__(self):
|
| 817 |
+
self.lib_controllers = []
|
| 818 |
+
self._load_libraries()
|
| 819 |
+
self._warn_if_incompatible_openmp()
|
| 820 |
+
|
| 821 |
+
@classmethod
|
| 822 |
+
def _from_controllers(cls, lib_controllers):
|
| 823 |
+
new_controller = cls.__new__(cls)
|
| 824 |
+
new_controller.lib_controllers = lib_controllers
|
| 825 |
+
return new_controller
|
| 826 |
+
|
| 827 |
+
def info(self):
|
| 828 |
+
"""Return lib_controllers info as a list of dicts"""
|
| 829 |
+
return [lib_controller.info() for lib_controller in self.lib_controllers]
|
| 830 |
+
|
| 831 |
+
def select(self, **kwargs):
|
| 832 |
+
"""Return a ThreadpoolController containing a subset of its current
|
| 833 |
+
library controllers
|
| 834 |
+
|
| 835 |
+
It will select all libraries matching at least one pair (key, value) from kwargs
|
| 836 |
+
where key is an entry of the library info dict (like "user_api", "internal_api",
|
| 837 |
+
"prefix", ...) and value is the value or a list of acceptable values for that
|
| 838 |
+
entry.
|
| 839 |
+
|
| 840 |
+
For instance, `ThreadpoolController().select(internal_api=["blis", "openblas"])`
|
| 841 |
+
will select all library controllers whose internal_api is either "blis" or
|
| 842 |
+
"openblas".
|
| 843 |
+
"""
|
| 844 |
+
for key, vals in kwargs.items():
|
| 845 |
+
kwargs[key] = [vals] if not isinstance(vals, list) else vals
|
| 846 |
+
|
| 847 |
+
lib_controllers = [
|
| 848 |
+
lib_controller
|
| 849 |
+
for lib_controller in self.lib_controllers
|
| 850 |
+
if any(
|
| 851 |
+
getattr(lib_controller, key, None) in vals
|
| 852 |
+
for key, vals in kwargs.items()
|
| 853 |
+
)
|
| 854 |
+
]
|
| 855 |
+
|
| 856 |
+
return ThreadpoolController._from_controllers(lib_controllers)
|
| 857 |
+
|
| 858 |
+
def _get_params_for_sequential_blas_under_openmp(self):
|
| 859 |
+
"""Return appropriate params to use for a sequential BLAS call in an OpenMP loop
|
| 860 |
+
|
| 861 |
+
This function takes into account the unexpected behavior of OpenBLAS with the
|
| 862 |
+
OpenMP threading layer.
|
| 863 |
+
"""
|
| 864 |
+
if self.select(
|
| 865 |
+
internal_api="openblas", threading_layer="openmp"
|
| 866 |
+
).lib_controllers:
|
| 867 |
+
return {"limits": None, "user_api": None}
|
| 868 |
+
return {"limits": 1, "user_api": "blas"}
|
| 869 |
+
|
| 870 |
+
@_format_docstring(
|
| 871 |
+
USER_APIS=", ".join('"{}"'.format(api) for api in _ALL_USER_APIS),
|
| 872 |
+
BLAS_LIBS=", ".join(_ALL_BLAS_LIBRARIES),
|
| 873 |
+
OPENMP_LIBS=", ".join(_ALL_OPENMP_LIBRARIES),
|
| 874 |
+
)
|
| 875 |
+
def limit(self, *, limits=None, user_api=None):
|
| 876 |
+
"""Change the maximal number of threads that can be used in thread pools.
|
| 877 |
+
|
| 878 |
+
This function returns an object that can be used either as a callable (the
|
| 879 |
+
construction of this object limits the number of threads) or as a context
|
| 880 |
+
manager, in a `with` block to automatically restore the original state of the
|
| 881 |
+
controlled libraries when exiting the block.
|
| 882 |
+
|
| 883 |
+
Set the maximal number of threads that can be used in thread pools used in
|
| 884 |
+
the supported libraries to `limits`. This function works for libraries that
|
| 885 |
+
are already loaded in the interpreter and can be changed dynamically.
|
| 886 |
+
|
| 887 |
+
This effect is global and impacts the whole Python process. There is no thread
|
| 888 |
+
level isolation as these libraries do not offer thread-local APIs to configure
|
| 889 |
+
the number of threads to use in nested parallel calls.
|
| 890 |
+
|
| 891 |
+
Parameters
|
| 892 |
+
----------
|
| 893 |
+
limits : int, dict, 'sequential_blas_under_openmp' or None (default=None)
|
| 894 |
+
The maximal number of threads that can be used in thread pools
|
| 895 |
+
|
| 896 |
+
- If int, sets the maximum number of threads to `limits` for each
|
| 897 |
+
library selected by `user_api`.
|
| 898 |
+
|
| 899 |
+
- If it is a dictionary `{{key: max_threads}}`, this function sets a
|
| 900 |
+
custom maximum number of threads for each `key` which can be either a
|
| 901 |
+
`user_api` or a `prefix` for a specific library.
|
| 902 |
+
|
| 903 |
+
- If 'sequential_blas_under_openmp', it will chose the appropriate `limits`
|
| 904 |
+
and `user_api` parameters for the specific use case of sequential BLAS
|
| 905 |
+
calls within an OpenMP parallel region. The `user_api` parameter is
|
| 906 |
+
ignored.
|
| 907 |
+
|
| 908 |
+
- If None, this function does not do anything.
|
| 909 |
+
|
| 910 |
+
user_api : {USER_APIS} or None (default=None)
|
| 911 |
+
APIs of libraries to limit. Used only if `limits` is an int.
|
| 912 |
+
|
| 913 |
+
- If "blas", it will only limit BLAS supported libraries ({BLAS_LIBS}).
|
| 914 |
+
|
| 915 |
+
- If "openmp", it will only limit OpenMP supported libraries
|
| 916 |
+
({OPENMP_LIBS}). Note that it can affect the number of threads used
|
| 917 |
+
by the BLAS libraries if they rely on OpenMP.
|
| 918 |
+
|
| 919 |
+
- If None, this function will apply to all supported libraries.
|
| 920 |
+
"""
|
| 921 |
+
return _ThreadpoolLimiter(self, limits=limits, user_api=user_api)
|
| 922 |
+
|
| 923 |
+
@_format_docstring(
|
| 924 |
+
USER_APIS=", ".join('"{}"'.format(api) for api in _ALL_USER_APIS),
|
| 925 |
+
BLAS_LIBS=", ".join(_ALL_BLAS_LIBRARIES),
|
| 926 |
+
OPENMP_LIBS=", ".join(_ALL_OPENMP_LIBRARIES),
|
| 927 |
+
)
|
| 928 |
+
def wrap(self, *, limits=None, user_api=None):
|
| 929 |
+
"""Change the maximal number of threads that can be used in thread pools.
|
| 930 |
+
|
| 931 |
+
This function returns an object that can be used as a decorator.
|
| 932 |
+
|
| 933 |
+
Set the maximal number of threads that can be used in thread pools used in
|
| 934 |
+
the supported libraries to `limits`. This function works for libraries that
|
| 935 |
+
are already loaded in the interpreter and can be changed dynamically.
|
| 936 |
+
|
| 937 |
+
Parameters
|
| 938 |
+
----------
|
| 939 |
+
limits : int, dict or None (default=None)
|
| 940 |
+
The maximal number of threads that can be used in thread pools
|
| 941 |
+
|
| 942 |
+
- If int, sets the maximum number of threads to `limits` for each
|
| 943 |
+
library selected by `user_api`.
|
| 944 |
+
|
| 945 |
+
- If it is a dictionary `{{key: max_threads}}`, this function sets a
|
| 946 |
+
custom maximum number of threads for each `key` which can be either a
|
| 947 |
+
`user_api` or a `prefix` for a specific library.
|
| 948 |
+
|
| 949 |
+
- If None, this function does not do anything.
|
| 950 |
+
|
| 951 |
+
user_api : {USER_APIS} or None (default=None)
|
| 952 |
+
APIs of libraries to limit. Used only if `limits` is an int.
|
| 953 |
+
|
| 954 |
+
- If "blas", it will only limit BLAS supported libraries ({BLAS_LIBS}).
|
| 955 |
+
|
| 956 |
+
- If "openmp", it will only limit OpenMP supported libraries
|
| 957 |
+
({OPENMP_LIBS}). Note that it can affect the number of threads used
|
| 958 |
+
by the BLAS libraries if they rely on OpenMP.
|
| 959 |
+
|
| 960 |
+
- If None, this function will apply to all supported libraries.
|
| 961 |
+
"""
|
| 962 |
+
return _ThreadpoolLimiter.wrap(self, limits=limits, user_api=user_api)
|
| 963 |
+
|
| 964 |
+
def __len__(self):
|
| 965 |
+
return len(self.lib_controllers)
|
| 966 |
+
|
| 967 |
+
def _load_libraries(self):
|
| 968 |
+
"""Loop through loaded shared libraries and store the supported ones"""
|
| 969 |
+
if sys.platform == "darwin":
|
| 970 |
+
self._find_libraries_with_dyld()
|
| 971 |
+
elif sys.platform == "win32":
|
| 972 |
+
self._find_libraries_with_enum_process_module_ex()
|
| 973 |
+
elif "pyodide" in sys.modules:
|
| 974 |
+
self._find_libraries_pyodide()
|
| 975 |
+
else:
|
| 976 |
+
self._find_libraries_with_dl_iterate_phdr()
|
| 977 |
+
|
| 978 |
+
def _find_libraries_with_dl_iterate_phdr(self):
|
| 979 |
+
"""Loop through loaded libraries and return binders on supported ones
|
| 980 |
+
|
| 981 |
+
This function is expected to work on POSIX system only.
|
| 982 |
+
This code is adapted from code by Intel developer @anton-malakhov
|
| 983 |
+
available at https://github.com/IntelPython/smp
|
| 984 |
+
|
| 985 |
+
Copyright (c) 2017, Intel Corporation published under the BSD 3-Clause
|
| 986 |
+
license
|
| 987 |
+
"""
|
| 988 |
+
libc = self._get_libc()
|
| 989 |
+
if not hasattr(libc, "dl_iterate_phdr"): # pragma: no cover
|
| 990 |
+
warnings.warn(
|
| 991 |
+
"Could not find dl_iterate_phdr in the C standard library.",
|
| 992 |
+
RuntimeWarning,
|
| 993 |
+
)
|
| 994 |
+
return []
|
| 995 |
+
|
| 996 |
+
# Callback function for `dl_iterate_phdr` which is called for every
|
| 997 |
+
# library loaded in the current process until it returns 1.
|
| 998 |
+
def match_library_callback(info, size, data):
|
| 999 |
+
# Get the path of the current library
|
| 1000 |
+
filepath = info.contents.dlpi_name
|
| 1001 |
+
if filepath:
|
| 1002 |
+
filepath = filepath.decode("utf-8")
|
| 1003 |
+
|
| 1004 |
+
# Store the library controller if it is supported and selected
|
| 1005 |
+
self._make_controller_from_path(filepath)
|
| 1006 |
+
return 0
|
| 1007 |
+
|
| 1008 |
+
c_func_signature = ctypes.CFUNCTYPE(
|
| 1009 |
+
ctypes.c_int, # Return type
|
| 1010 |
+
ctypes.POINTER(_dl_phdr_info),
|
| 1011 |
+
ctypes.c_size_t,
|
| 1012 |
+
ctypes.c_char_p,
|
| 1013 |
+
)
|
| 1014 |
+
c_match_library_callback = c_func_signature(match_library_callback)
|
| 1015 |
+
|
| 1016 |
+
data = ctypes.c_char_p(b"")
|
| 1017 |
+
libc.dl_iterate_phdr(c_match_library_callback, data)
|
| 1018 |
+
|
| 1019 |
+
def _find_libraries_with_dyld(self):
|
| 1020 |
+
"""Loop through loaded libraries and return binders on supported ones
|
| 1021 |
+
|
| 1022 |
+
This function is expected to work on OSX system only
|
| 1023 |
+
"""
|
| 1024 |
+
libc = self._get_libc()
|
| 1025 |
+
if not hasattr(libc, "_dyld_image_count"): # pragma: no cover
|
| 1026 |
+
warnings.warn(
|
| 1027 |
+
"Could not find _dyld_image_count in the C standard library.",
|
| 1028 |
+
RuntimeWarning,
|
| 1029 |
+
)
|
| 1030 |
+
return []
|
| 1031 |
+
|
| 1032 |
+
n_dyld = libc._dyld_image_count()
|
| 1033 |
+
libc._dyld_get_image_name.restype = ctypes.c_char_p
|
| 1034 |
+
|
| 1035 |
+
for i in range(n_dyld):
|
| 1036 |
+
filepath = ctypes.string_at(libc._dyld_get_image_name(i))
|
| 1037 |
+
filepath = filepath.decode("utf-8")
|
| 1038 |
+
|
| 1039 |
+
# Store the library controller if it is supported and selected
|
| 1040 |
+
self._make_controller_from_path(filepath)
|
| 1041 |
+
|
| 1042 |
+
def _find_libraries_with_enum_process_module_ex(self):
|
| 1043 |
+
"""Loop through loaded libraries and return binders on supported ones
|
| 1044 |
+
|
| 1045 |
+
This function is expected to work on windows system only.
|
| 1046 |
+
This code is adapted from code by Philipp Hagemeister @phihag available
|
| 1047 |
+
at https://stackoverflow.com/questions/17474574
|
| 1048 |
+
"""
|
| 1049 |
+
from ctypes.wintypes import DWORD, HMODULE, MAX_PATH
|
| 1050 |
+
|
| 1051 |
+
PROCESS_QUERY_INFORMATION = 0x0400
|
| 1052 |
+
PROCESS_VM_READ = 0x0010
|
| 1053 |
+
|
| 1054 |
+
LIST_LIBRARIES_ALL = 0x03
|
| 1055 |
+
|
| 1056 |
+
ps_api = self._get_windll("Psapi")
|
| 1057 |
+
kernel_32 = self._get_windll("kernel32")
|
| 1058 |
+
|
| 1059 |
+
h_process = kernel_32.OpenProcess(
|
| 1060 |
+
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, False, os.getpid()
|
| 1061 |
+
)
|
| 1062 |
+
if not h_process: # pragma: no cover
|
| 1063 |
+
raise OSError(f"Could not open PID {os.getpid()}")
|
| 1064 |
+
|
| 1065 |
+
try:
|
| 1066 |
+
buf_count = 256
|
| 1067 |
+
needed = DWORD()
|
| 1068 |
+
# Grow the buffer until it becomes large enough to hold all the
|
| 1069 |
+
# module headers
|
| 1070 |
+
while True:
|
| 1071 |
+
buf = (HMODULE * buf_count)()
|
| 1072 |
+
buf_size = ctypes.sizeof(buf)
|
| 1073 |
+
if not ps_api.EnumProcessModulesEx(
|
| 1074 |
+
h_process,
|
| 1075 |
+
ctypes.byref(buf),
|
| 1076 |
+
buf_size,
|
| 1077 |
+
ctypes.byref(needed),
|
| 1078 |
+
LIST_LIBRARIES_ALL,
|
| 1079 |
+
):
|
| 1080 |
+
raise OSError("EnumProcessModulesEx failed")
|
| 1081 |
+
if buf_size >= needed.value:
|
| 1082 |
+
break
|
| 1083 |
+
buf_count = needed.value // (buf_size // buf_count)
|
| 1084 |
+
|
| 1085 |
+
count = needed.value // (buf_size // buf_count)
|
| 1086 |
+
h_modules = map(HMODULE, buf[:count])
|
| 1087 |
+
|
| 1088 |
+
# Loop through all the module headers and get the library path
|
| 1089 |
+
# Allocate a buffer for the path 10 times the size of MAX_PATH to take
|
| 1090 |
+
# into account long path names.
|
| 1091 |
+
max_path = 10 * MAX_PATH
|
| 1092 |
+
buf = ctypes.create_unicode_buffer(max_path)
|
| 1093 |
+
n_size = DWORD()
|
| 1094 |
+
for h_module in h_modules:
|
| 1095 |
+
# Get the path of the current module
|
| 1096 |
+
if not ps_api.GetModuleFileNameExW(
|
| 1097 |
+
h_process, h_module, ctypes.byref(buf), ctypes.byref(n_size)
|
| 1098 |
+
):
|
| 1099 |
+
raise OSError("GetModuleFileNameEx failed")
|
| 1100 |
+
filepath = buf.value
|
| 1101 |
+
|
| 1102 |
+
if len(filepath) == max_path: # pragma: no cover
|
| 1103 |
+
warnings.warn(
|
| 1104 |
+
"Could not get the full path of a dynamic library (path too "
|
| 1105 |
+
"long). This library will be ignored and threadpoolctl might "
|
| 1106 |
+
"not be able to control or display information about all "
|
| 1107 |
+
f"loaded libraries. Here's the truncated path: {filepath!r}",
|
| 1108 |
+
RuntimeWarning,
|
| 1109 |
+
)
|
| 1110 |
+
else:
|
| 1111 |
+
# Store the library controller if it is supported and selected
|
| 1112 |
+
self._make_controller_from_path(filepath)
|
| 1113 |
+
finally:
|
| 1114 |
+
kernel_32.CloseHandle(h_process)
|
| 1115 |
+
|
| 1116 |
+
def _find_libraries_pyodide(self):
|
| 1117 |
+
"""Pyodide specific implementation for finding loaded libraries.
|
| 1118 |
+
|
| 1119 |
+
Adapted from suggestion in https://github.com/joblib/threadpoolctl/pull/169#issuecomment-1946696449.
|
| 1120 |
+
|
| 1121 |
+
One day, we may have a simpler solution. libc dl_iterate_phdr needs to
|
| 1122 |
+
be implemented in Emscripten and exposed in Pyodide, see
|
| 1123 |
+
https://github.com/emscripten-core/emscripten/issues/21354 for more
|
| 1124 |
+
details.
|
| 1125 |
+
"""
|
| 1126 |
+
try:
|
| 1127 |
+
from pyodide_js._module import LDSO
|
| 1128 |
+
except ImportError:
|
| 1129 |
+
warnings.warn(
|
| 1130 |
+
"Unable to import LDSO from pyodide_js._module. This should never "
|
| 1131 |
+
"happen."
|
| 1132 |
+
)
|
| 1133 |
+
return
|
| 1134 |
+
|
| 1135 |
+
for filepath in LDSO.loadedLibsByName.as_object_map():
|
| 1136 |
+
# Some libraries are duplicated by Pyodide and do not exist in the
|
| 1137 |
+
# filesystem, so we first check for the existence of the file. For
|
| 1138 |
+
# more details, see
|
| 1139 |
+
# https://github.com/joblib/threadpoolctl/pull/169#issuecomment-1947946728
|
| 1140 |
+
if os.path.exists(filepath):
|
| 1141 |
+
self._make_controller_from_path(filepath)
|
| 1142 |
+
|
| 1143 |
+
def _make_controller_from_path(self, filepath):
|
| 1144 |
+
"""Store a library controller if it is supported and selected"""
|
| 1145 |
+
# Required to resolve symlinks
|
| 1146 |
+
filepath = _realpath(filepath)
|
| 1147 |
+
# `lower` required to take account of OpenMP dll case on Windows
|
| 1148 |
+
# (vcomp, VCOMP, Vcomp, ...)
|
| 1149 |
+
filename = os.path.basename(filepath).lower()
|
| 1150 |
+
|
| 1151 |
+
# Loop through supported libraries to find if this filename corresponds
|
| 1152 |
+
# to a supported one.
|
| 1153 |
+
for controller_class in _ALL_CONTROLLERS:
|
| 1154 |
+
# check if filename matches a supported prefix
|
| 1155 |
+
prefix = self._check_prefix(filename, controller_class.filename_prefixes)
|
| 1156 |
+
|
| 1157 |
+
# filename does not match any of the prefixes of the candidate
|
| 1158 |
+
# library. move to next library.
|
| 1159 |
+
if prefix is None:
|
| 1160 |
+
continue
|
| 1161 |
+
|
| 1162 |
+
# workaround for BLAS libraries packaged by conda-forge on windows, which
|
| 1163 |
+
# are all renamed "libblas.dll". We thus have to check to which BLAS
|
| 1164 |
+
# implementation it actually corresponds looking for implementation
|
| 1165 |
+
# specific symbols.
|
| 1166 |
+
if prefix == "libblas":
|
| 1167 |
+
if filename.endswith(".dll"):
|
| 1168 |
+
libblas = ctypes.CDLL(filepath, _RTLD_NOLOAD)
|
| 1169 |
+
if not any(
|
| 1170 |
+
hasattr(libblas, func)
|
| 1171 |
+
for func in controller_class.check_symbols
|
| 1172 |
+
):
|
| 1173 |
+
continue
|
| 1174 |
+
else:
|
| 1175 |
+
# We ignore libblas on other platforms than windows because there
|
| 1176 |
+
# might be a libblas dso comming with openblas for instance that
|
| 1177 |
+
# can't be used to instantiate a pertinent LibController (many
|
| 1178 |
+
# symbols are missing) and would create confusion by making a
|
| 1179 |
+
# duplicate entry in threadpool_info.
|
| 1180 |
+
continue
|
| 1181 |
+
|
| 1182 |
+
# filename matches a prefix. Now we check if the library has the symbols we
|
| 1183 |
+
# are looking for. If none of the symbols exists, it's very likely not the
|
| 1184 |
+
# expected library (e.g. a library having a common prefix with one of the
|
| 1185 |
+
# our supported libraries). Otherwise, create and store the library
|
| 1186 |
+
# controller.
|
| 1187 |
+
lib_controller = controller_class(
|
| 1188 |
+
filepath=filepath, prefix=prefix, parent=self
|
| 1189 |
+
)
|
| 1190 |
+
|
| 1191 |
+
if filepath in (lib.filepath for lib in self.lib_controllers):
|
| 1192 |
+
# We already have a controller for this library.
|
| 1193 |
+
continue
|
| 1194 |
+
|
| 1195 |
+
if not hasattr(controller_class, "check_symbols") or any(
|
| 1196 |
+
hasattr(lib_controller.dynlib, func)
|
| 1197 |
+
for func in controller_class.check_symbols
|
| 1198 |
+
):
|
| 1199 |
+
self.lib_controllers.append(lib_controller)
|
| 1200 |
+
|
| 1201 |
+
def _check_prefix(self, library_basename, filename_prefixes):
|
| 1202 |
+
"""Return the prefix library_basename starts with
|
| 1203 |
+
|
| 1204 |
+
Return None if none matches.
|
| 1205 |
+
"""
|
| 1206 |
+
for prefix in filename_prefixes:
|
| 1207 |
+
if library_basename.startswith(prefix):
|
| 1208 |
+
return prefix
|
| 1209 |
+
return None
|
| 1210 |
+
|
| 1211 |
+
def _warn_if_incompatible_openmp(self):
|
| 1212 |
+
"""Raise a warning if llvm-OpenMP and intel-OpenMP are both loaded"""
|
| 1213 |
+
prefixes = [lib_controller.prefix for lib_controller in self.lib_controllers]
|
| 1214 |
+
msg = textwrap.dedent(
|
| 1215 |
+
"""
|
| 1216 |
+
Found Intel OpenMP ('libiomp') and LLVM OpenMP ('libomp') loaded at
|
| 1217 |
+
the same time. Both libraries are known to be incompatible and this
|
| 1218 |
+
can cause random crashes or deadlocks on Linux when loaded in the
|
| 1219 |
+
same Python program.
|
| 1220 |
+
Using threadpoolctl may cause crashes or deadlocks. For more
|
| 1221 |
+
information and possible workarounds, please see
|
| 1222 |
+
https://github.com/joblib/threadpoolctl/blob/master/multiple_openmp.md
|
| 1223 |
+
"""
|
| 1224 |
+
)
|
| 1225 |
+
if "libomp" in prefixes and "libiomp" in prefixes:
|
| 1226 |
+
warnings.warn(msg, RuntimeWarning)
|
| 1227 |
+
|
| 1228 |
+
@classmethod
|
| 1229 |
+
def _get_libc(cls):
|
| 1230 |
+
"""Load the lib-C for unix systems."""
|
| 1231 |
+
libc = cls._system_libraries.get("libc")
|
| 1232 |
+
if libc is None:
|
| 1233 |
+
# Remark: If libc is statically linked or if Python is linked against an
|
| 1234 |
+
# alternative implementation of libc like musl, find_library will return
|
| 1235 |
+
# None and CDLL will load the main program itself which should contain the
|
| 1236 |
+
# libc symbols. We still name it libc for convenience.
|
| 1237 |
+
# If the main program does not contain the libc symbols, it's ok because
|
| 1238 |
+
# we check their presence later anyway.
|
| 1239 |
+
libc = ctypes.CDLL(find_library("c"), mode=_RTLD_NOLOAD)
|
| 1240 |
+
cls._system_libraries["libc"] = libc
|
| 1241 |
+
return libc
|
| 1242 |
+
|
| 1243 |
+
@classmethod
|
| 1244 |
+
def _get_windll(cls, dll_name):
|
| 1245 |
+
"""Load a windows DLL"""
|
| 1246 |
+
dll = cls._system_libraries.get(dll_name)
|
| 1247 |
+
if dll is None:
|
| 1248 |
+
dll = ctypes.WinDLL(f"{dll_name}.dll")
|
| 1249 |
+
cls._system_libraries[dll_name] = dll
|
| 1250 |
+
return dll
|
| 1251 |
+
|
| 1252 |
+
|
| 1253 |
+
def _main():
|
| 1254 |
+
"""Commandline interface to display thread-pool information and exit."""
|
| 1255 |
+
import argparse
|
| 1256 |
+
import importlib
|
| 1257 |
+
import json
|
| 1258 |
+
import sys
|
| 1259 |
+
|
| 1260 |
+
parser = argparse.ArgumentParser(
|
| 1261 |
+
usage="python -m threadpoolctl -i numpy scipy.linalg xgboost",
|
| 1262 |
+
description="Display thread-pool information and exit.",
|
| 1263 |
+
)
|
| 1264 |
+
parser.add_argument(
|
| 1265 |
+
"-i",
|
| 1266 |
+
"--import",
|
| 1267 |
+
dest="modules",
|
| 1268 |
+
nargs="*",
|
| 1269 |
+
default=(),
|
| 1270 |
+
help="Python modules to import before introspecting thread-pools.",
|
| 1271 |
+
)
|
| 1272 |
+
parser.add_argument(
|
| 1273 |
+
"-c",
|
| 1274 |
+
"--command",
|
| 1275 |
+
help="a Python statement to execute before introspecting thread-pools.",
|
| 1276 |
+
)
|
| 1277 |
+
|
| 1278 |
+
options = parser.parse_args(sys.argv[1:])
|
| 1279 |
+
for module in options.modules:
|
| 1280 |
+
try:
|
| 1281 |
+
importlib.import_module(module, package=None)
|
| 1282 |
+
except ImportError:
|
| 1283 |
+
print("WARNING: could not import", module, file=sys.stderr)
|
| 1284 |
+
|
| 1285 |
+
if options.command:
|
| 1286 |
+
exec(options.command)
|
| 1287 |
+
|
| 1288 |
+
print(json.dumps(threadpool_info(), indent=2))
|
| 1289 |
+
|
| 1290 |
+
|
| 1291 |
+
if __name__ == "__main__":
|
| 1292 |
+
_main()
|
CasualLab/.venv/lib/python3.12/site-packages/typing_extensions.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CasualLab/artifacts/benchmarks/equilibrium/ledger.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
scenario,treatment_version,mean_wait_minutes,mean_service_probability,equilibrium_converged,equilibrium_iterations,equilibrium_residual_sup_norm,trips,latent_demand,available_drivers,rider_discount_spend,driver_incentive_spend,treatment_spend,rider_surplus,driver_surplus,platform_net_revenue,total_welfare,welfare_accounting_residual,budget,budget_binding,budget_scale
|
| 2 |
+
control,bundled,5.164703853749131,0.6154836969993391,True,10,2.1355126000877078e-11,120.34967616840675,196.25724223894588,143.8958897853139,0.0,0.0,0.0,1190.1386427817013,650.1501121177835,601.7483808420337,2442.037135741519,0.0,,False,0.0
|
| 3 |
+
treatment,bundled,4.685512378230883,0.6664124266937543,True,10,2.1355122531430126e-11,151.02722122989283,227.39544625776875,191.60920402951393,302.05444245978566,383.21840805902787,685.2728505188136,1847.3267155046256,1193.5771334236276,69.86325563065074,3110.767104558904,-2.2737367544323206e-13,,False,1.0
|
CasualLab/artifacts/benchmarks/equilibrium/manifest.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bundle_type": "two_sided_fixed_point_equilibrium_benchmark",
|
| 3 |
+
"causal_scope": "within_declared_equilibrium_model_only",
|
| 4 |
+
"checks": {
|
| 5 |
+
"budget_feasible": true,
|
| 6 |
+
"common_random_numbers_verified": true,
|
| 7 |
+
"control_equilibrium_converged": true,
|
| 8 |
+
"ground_truth_recomputed": true,
|
| 9 |
+
"hashes_recomputed": true,
|
| 10 |
+
"residuals_within_tolerance": true,
|
| 11 |
+
"sufficient_uniqueness_condition_satisfied": true,
|
| 12 |
+
"treatment_equilibrium_converged": true,
|
| 13 |
+
"welfare_accounting_balanced": true
|
| 14 |
+
},
|
| 15 |
+
"declared_file_set_sha256": "018b6c7ef7fa32c2149730dd6819b004ebdf24ace67b25adac2cd061eb48d880",
|
| 16 |
+
"empirical_calibration_status": "not_an_empirical_or_nyc_structural_estimate",
|
| 17 |
+
"evidence_type": "theoretical_simulation_known_ground_truth",
|
| 18 |
+
"files": [
|
| 19 |
+
{
|
| 20 |
+
"bytes": 918,
|
| 21 |
+
"path": "artifacts/benchmarks/equilibrium/ledger.csv",
|
| 22 |
+
"sha256": "f1262280177172afb55be586248b68d833eb4441a7b2e13177e7752fa91f0972"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"bytes": 4912,
|
| 26 |
+
"path": "artifacts/benchmarks/equilibrium/summary.json",
|
| 27 |
+
"sha256": "90610ab305f8e6efb0806b42dc6a8ddcc786353ddedbf6e0d02aa8345a63b568"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"bytes": 980,
|
| 31 |
+
"path": "artifacts/benchmarks/equilibrium/zone_effects.csv",
|
| 32 |
+
"sha256": "015f79ea19b762475f7e13daeccacfe251360551643e83c4573374a9a9efa119"
|
| 33 |
+
}
|
| 34 |
+
],
|
| 35 |
+
"is_nyc_structural_estimate": false,
|
| 36 |
+
"metadata": {
|
| 37 |
+
"common_random_numbers": true,
|
| 38 |
+
"ground_truth_status": "known_exactly_for_the_paired_model_counterfactuals",
|
| 39 |
+
"simulation_seed": 202503,
|
| 40 |
+
"state_id": "3b57b112bbcbcc4e065abd82905abdcc07f8c89a4ca99411dcfb0c1ec58728ae",
|
| 41 |
+
"treatment_version": "bundled"
|
| 42 |
+
},
|
| 43 |
+
"portable_paths": true,
|
| 44 |
+
"schema_version": 1
|
| 45 |
+
}
|
CasualLab/artifacts/benchmarks/equilibrium/summary.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"budget_diagnostics": {
|
| 3 |
+
"binding": false,
|
| 4 |
+
"budget": null,
|
| 5 |
+
"budget_feasible": true,
|
| 6 |
+
"budget_residual": null,
|
| 7 |
+
"budget_scale": 1.0,
|
| 8 |
+
"budget_search_iterations": 0,
|
| 9 |
+
"planned_treatment_spend": 685.2728505188136,
|
| 10 |
+
"realized_treatment_spend": 685.2728505188136
|
| 11 |
+
},
|
| 12 |
+
"causal_scope": "within_declared_equilibrium_model_only",
|
| 13 |
+
"common_random_numbers": true,
|
| 14 |
+
"configuration": {
|
| 15 |
+
"base_demand": 100.0,
|
| 16 |
+
"base_drivers": 72.0,
|
| 17 |
+
"base_fare": 20.0,
|
| 18 |
+
"base_wait_minutes": 5.0,
|
| 19 |
+
"budget": null,
|
| 20 |
+
"budget_max_iterations": 80,
|
| 21 |
+
"budget_tolerance": 1e-08,
|
| 22 |
+
"capacity_per_driver": 1.3,
|
| 23 |
+
"congestion_elasticity": 0.7,
|
| 24 |
+
"cross_zone_enabled": true,
|
| 25 |
+
"cross_zone_share": 0.2,
|
| 26 |
+
"demand_price_semielasticity": 1.2,
|
| 27 |
+
"demand_shock_sd": 0.08,
|
| 28 |
+
"demand_wait_elasticity": 0.28,
|
| 29 |
+
"discount_rate": 0.1,
|
| 30 |
+
"driver_operating_cost_per_trip": 9.0,
|
| 31 |
+
"driver_opportunity_cost_per_active_driver": 0.5,
|
| 32 |
+
"incentive_per_driver": 2.0,
|
| 33 |
+
"max_iterations": 500,
|
| 34 |
+
"n_zones": 2,
|
| 35 |
+
"platform_take_rate": 0.25,
|
| 36 |
+
"reference_incentive_per_driver": 2.0,
|
| 37 |
+
"relaxation": 0.75,
|
| 38 |
+
"rider_value_per_trip": 32.0,
|
| 39 |
+
"seed": 202503,
|
| 40 |
+
"supply_incentive_semielasticity": 0.3,
|
| 41 |
+
"supply_shock_sd": 0.06,
|
| 42 |
+
"supply_wait_elasticity": 0.14,
|
| 43 |
+
"tolerance": 1e-10,
|
| 44 |
+
"treatment_version": "bundled",
|
| 45 |
+
"wait_disutility_per_minute": 0.25
|
| 46 |
+
},
|
| 47 |
+
"control_diagnostics": {
|
| 48 |
+
"contraction_bound": 0.294,
|
| 49 |
+
"converged": true,
|
| 50 |
+
"effective_iteration_bound": 0.4705,
|
| 51 |
+
"initial_residual_sup_norm": 0.08297340789156935,
|
| 52 |
+
"iterations": 10,
|
| 53 |
+
"residual_sup_norm": 2.1355126000877078e-11,
|
| 54 |
+
"step_sup_norm": 1.3607752424871222e-10,
|
| 55 |
+
"termination_reason": "residual_tolerance_satisfied",
|
| 56 |
+
"tolerance": 1e-10,
|
| 57 |
+
"uniqueness_condition_satisfied": true
|
| 58 |
+
},
|
| 59 |
+
"cross_zone_channel": true,
|
| 60 |
+
"empirical_calibration_status": "not_an_empirical_or_nyc_structural_estimate",
|
| 61 |
+
"equations": {
|
| 62 |
+
"driver_supply": "S_z = B_z * exp(supply_incentive_semielasticity * incentive_z/reference_incentive + supply_wait_elasticity * x_z)",
|
| 63 |
+
"equilibrium_variable": "x_z = log(wait_z / base_wait_minutes)",
|
| 64 |
+
"rider_demand": "D_z = A_z * exp(demand_price_semielasticity * discount_z - demand_wait_elasticity * x_z)",
|
| 65 |
+
"served_trips": "Q_z = D_z * p_z",
|
| 66 |
+
"service_probability": "p_z = 1 - exp(-capacity_per_driver*S_z/D_z)",
|
| 67 |
+
"uniqueness_and_convergence": "Banach sufficient condition: congestion_elasticity * (demand_wait_elasticity + supply_wait_elasticity) < 1",
|
| 68 |
+
"wait_fixed_point": "x_z = congestion_elasticity * ((1-cross_zone_share)*log(D_z/(capacity*S_z)) + cross_zone_share*sum_j W_zj*log(D_j/(capacity*S_j)))",
|
| 69 |
+
"welfare": "rider_surplus + driver_surplus + platform_net_revenue; monetary transfers cancel, while waiting, driver opportunity, and trip operating costs remain"
|
| 70 |
+
},
|
| 71 |
+
"evidence_type": "theoretical_simulation_known_ground_truth",
|
| 72 |
+
"ground_truth": {
|
| 73 |
+
"incremental_trips_per_dollar": 0.04476690567598061,
|
| 74 |
+
"incremental_welfare_per_dollar": 0.975859423456068,
|
| 75 |
+
"market_total_effect": 30.677545061486086,
|
| 76 |
+
"market_total_trip_effect": 30.677545061486086,
|
| 77 |
+
"market_total_welfare_effect": 668.7299688173857,
|
| 78 |
+
"mean_zone_service_probability_effect": 0.05092872969441509,
|
| 79 |
+
"mean_zone_trip_effect": 15.338772530743043,
|
| 80 |
+
"mean_zone_wait_effect_minutes": -0.4791914755182476,
|
| 81 |
+
"treatment_spend": 685.2728505188136
|
| 82 |
+
},
|
| 83 |
+
"ground_truth_status": "known_exactly_for_the_paired_model_counterfactuals",
|
| 84 |
+
"is_nyc_structural_estimate": false,
|
| 85 |
+
"limitations": [
|
| 86 |
+
"This is a theoretical simulation benchmark, not an empirical causal estimate.",
|
| 87 |
+
"Parameters are declared assumptions and are not estimated from NYC data.",
|
| 88 |
+
"The model is a static fixed point and omits forward-looking entry and relocation.",
|
| 89 |
+
"The contraction condition is sufficient; paths failing it are withheld.",
|
| 90 |
+
"Welfare inherits the declared value, waiting-cost, and driver-cost assumptions."
|
| 91 |
+
],
|
| 92 |
+
"planned_treatment_intensity": [
|
| 93 |
+
1.0,
|
| 94 |
+
1.0
|
| 95 |
+
],
|
| 96 |
+
"realized_budget_scale": 1.0,
|
| 97 |
+
"schema_version": 1,
|
| 98 |
+
"simulation_seed": 202503,
|
| 99 |
+
"state_id": "3b57b112bbcbcc4e065abd82905abdcc07f8c89a4ca99411dcfb0c1ec58728ae",
|
| 100 |
+
"treatment_diagnostics": {
|
| 101 |
+
"contraction_bound": 0.294,
|
| 102 |
+
"converged": true,
|
| 103 |
+
"effective_iteration_bound": 0.4705,
|
| 104 |
+
"initial_residual_sup_norm": 0.1267342962804149,
|
| 105 |
+
"iterations": 10,
|
| 106 |
+
"residual_sup_norm": 2.1355122531430126e-11,
|
| 107 |
+
"step_sup_norm": 1.3607848181607096e-10,
|
| 108 |
+
"termination_reason": "residual_tolerance_satisfied",
|
| 109 |
+
"tolerance": 1e-10,
|
| 110 |
+
"uniqueness_condition_satisfied": true
|
| 111 |
+
},
|
| 112 |
+
"treatment_version": "bundled",
|
| 113 |
+
"uniqueness_diagnostics": {
|
| 114 |
+
"condition": "congestion_elasticity * (demand_wait_elasticity + supply_wait_elasticity) < 1",
|
| 115 |
+
"contraction_bound": 0.294,
|
| 116 |
+
"effective_iteration_bound": 0.4705,
|
| 117 |
+
"sufficient_condition_satisfied": true
|
| 118 |
+
}
|
| 119 |
+
}
|
CasualLab/artifacts/benchmarks/equilibrium/zone_effects.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
zone_id,control_trips,treatment_trips,trip_effect,control_wait_minutes,treatment_wait_minutes,wait_effect_minutes,control_service_probability,treatment_service_probability,service_probability_effect,control_welfare,treatment_welfare,welfare_effect,realized_treatment_intensity,state_id,evidence_type
|
| 2 |
+
0,61.51217341183757,77.49686922339092,15.984695811553344,5.348375727117535,4.852142810598422,-0.49623291651911305,0.5843879819549537,0.6354308417059347,0.051042859750980996,1238.4933121889737,1587.1551624293704,348.6618502403967,1.0,3b57b112bbcbcc4e065abd82905abdcc07f8c89a4ca99411dcfb0c1ec58728ae,theoretical_simulation_known_ground_truth
|
| 3 |
+
1,58.83750275656917,73.53035200650191,14.692849249932742,4.981031980380727,4.5188819458633445,-0.4621500345173821,0.6465794120437247,0.6973940116815739,0.05081459963784918,1203.5438235525448,1523.6119421295339,320.06811857698904,1.0,3b57b112bbcbcc4e065abd82905abdcc07f8c89a4ca99411dcfb0c1ec58728ae,theoretical_simulation_known_ground_truth
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_calibration_by_score.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
score_bin,mean_predicted_cate,mean_known_truth,mean_error,rmse,rows
|
| 2 |
+
"(0.13, 0.185]",0.16988634410708575,0.217882285985877,-0.04799594187879125,0.05292489377756387,77
|
| 3 |
+
"(0.185, 0.204]",0.1936838736903957,0.2345534189965966,-0.040869545306200884,0.04781209945413844,77
|
| 4 |
+
"(0.204, 0.223]",0.21348634941244207,0.24213614269038233,-0.028649793277940244,0.0368605339246351,76
|
| 5 |
+
"(0.223, 0.247]",0.23321505815139293,0.237193642591561,-0.003978584440168065,0.025575299836887538,77
|
| 6 |
+
"(0.247, 0.306]",0.26604600595979044,0.23540305681350612,0.030642949146284307,0.04000060469718305,77
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_calibration_chart.html
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<style>
|
| 6 |
+
#vis.vega-embed {
|
| 7 |
+
width: 100%;
|
| 8 |
+
display: flex;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
#vis.vega-embed details,
|
| 12 |
+
#vis.vega-embed details summary {
|
| 13 |
+
position: relative;
|
| 14 |
+
}
|
| 15 |
+
</style>
|
| 16 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega@6"></script>
|
| 17 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-lite@6.4.1"></script>
|
| 18 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vega-embed@7"></script>
|
| 19 |
+
</head>
|
| 20 |
+
<body>
|
| 21 |
+
<div id="vis"></div>
|
| 22 |
+
<script>
|
| 23 |
+
(function(vegaEmbed) {
|
| 24 |
+
var spec = {"config": {"view": {"continuousWidth": 300, "continuousHeight": 300}}, "data": {"name": "data-f788e0d4bc6fad9250cf4bbd676b727c"}, "mark": {"type": "line", "point": true}, "encoding": {"tooltip": [{"field": "score_bin", "type": "nominal"}, {"field": "rows", "type": "quantitative"}, {"field": "mean_known_truth", "type": "quantitative"}, {"field": "mean_predicted_cate", "type": "quantitative"}, {"field": "mean_error", "type": "quantitative"}], "x": {"field": "mean_known_truth", "title": "Mean known controlled-zone truth", "type": "quantitative"}, "y": {"field": "mean_predicted_cate", "title": "Mean cross-fitted predicted CATE", "type": "quantitative"}}, "title": "CATE calibration by held-out score bin", "$schema": "https://vega.github.io/schema/vega-lite/v6.4.1.json", "datasets": {"data-f788e0d4bc6fad9250cf4bbd676b727c": [{"score_bin": "(0.13, 0.185]", "mean_predicted_cate": 0.16988634410708575, "mean_known_truth": 0.217882285985877, "mean_error": -0.04799594187879125, "rmse": 0.05292489377756387, "rows": 77}, {"score_bin": "(0.185, 0.204]", "mean_predicted_cate": 0.1936838736903957, "mean_known_truth": 0.2345534189965966, "mean_error": -0.040869545306200884, "rmse": 0.04781209945413844, "rows": 77}, {"score_bin": "(0.204, 0.223]", "mean_predicted_cate": 0.21348634941244207, "mean_known_truth": 0.24213614269038233, "mean_error": -0.028649793277940244, "rmse": 0.0368605339246351, "rows": 76}, {"score_bin": "(0.223, 0.247]", "mean_predicted_cate": 0.23321505815139293, "mean_known_truth": 0.237193642591561, "mean_error": -0.003978584440168065, "rmse": 0.025575299836887538, "rows": 77}, {"score_bin": "(0.247, 0.306]", "mean_predicted_cate": 0.26604600595979044, "mean_known_truth": 0.23540305681350612, "mean_error": 0.030642949146284307, "rmse": 0.04000060469718305, "rows": 77}]}};
|
| 25 |
+
var embedOpt = {"mode": "vega-lite"};
|
| 26 |
+
|
| 27 |
+
function showError(el, error){
|
| 28 |
+
el.innerHTML = ('<div style="color:red;">'
|
| 29 |
+
+ '<p>JavaScript Error: ' + error.message + '</p>'
|
| 30 |
+
+ "<p>This usually means there's a typo in your chart specification. "
|
| 31 |
+
+ "See the javascript console for the full traceback.</p>"
|
| 32 |
+
+ '</div>');
|
| 33 |
+
throw error;
|
| 34 |
+
}
|
| 35 |
+
const el = document.getElementById('vis');
|
| 36 |
+
vegaEmbed("#vis", spec, embedOpt)
|
| 37 |
+
.catch(error => showError(el, error));
|
| 38 |
+
})(vegaEmbed);
|
| 39 |
+
|
| 40 |
+
</script>
|
| 41 |
+
</body>
|
| 42 |
+
</html>
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_feature_importance.csv
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
feature,mean_importance,importance_sd_across_folds,evidence_type
|
| 2 |
+
assigned_treatment,0.3245378379954551,0.04631164147423287,model_diagnostic
|
| 3 |
+
baseline_demand,0.2727426567855801,0.08873460462174707,model_diagnostic
|
| 4 |
+
hour_cos,0.2352136267158721,0.03529888032359747,model_diagnostic
|
| 5 |
+
hour_sin,0.11286437312530201,0.012128425309538959,model_diagnostic
|
| 6 |
+
market_tightness,0.054641505377790736,0.01693190842942036,model_diagnostic
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_fold_stability.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
crossfit_fold,mean_predicted_cate,mean_known_truth,mean_error,rmse,rows
|
| 2 |
+
0,0.23499121598443928,0.23675977336839374,-0.0017685573839544462,0.03910664796744686,96
|
| 3 |
+
1,0.2130453448810877,0.24044368325925006,-0.027398338378162346,0.04238915763947444,96
|
| 4 |
+
2,0.2290803934002759,0.23821217522145566,-0.009131781821179755,0.042720906273505145,96
|
| 5 |
+
3,0.18395566304995536,0.21822855546662653,-0.034272892416671176,0.042575026007559316,96
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_predictions.csv
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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+
unit_id,zone_id,period_id,predicted_y1,predicted_y0,estimated_cate,crossfit_fold,evidence_type,known_controlled_zone_truth,prediction_error
|
| 2 |
+
0,0,0,1.7693348764539056,1.6006035077659362,0.16873136868796945,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.17931154784069125,-0.010580179152721803
|
| 3 |
+
1,1,0,1.7574129996764163,1.5698464274867956,0.1875665721896207,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19013027048901843,-0.002563698299397732
|
| 4 |
+
2,2,0,1.7696611084051015,1.5552250825936849,0.21443602581141663,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23158321469119292,-0.017147188879776287
|
| 5 |
+
3,3,0,1.838589378327523,1.5648316480957072,0.2737577302318157,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2048290431445352,0.0689286870872805
|
| 6 |
+
4,4,0,1.7716916865879409,1.5678116242649802,0.20388006232296063,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22171742283912765,-0.017837360516167022
|
| 7 |
+
5,5,0,1.7724131526624434,1.5764382399086128,0.1959749127538306,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2169246414839261,-0.020949728730095485
|
| 8 |
+
6,6,0,1.8108415170459107,1.5502324813895083,0.26060903565640237,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20105940719998694,0.05954962845641543
|
| 9 |
+
7,7,0,1.8125065706288506,1.5662330924485786,0.246273478180272,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.215467279432908,0.03080619874736401
|
| 10 |
+
8,0,1,1.8967421539737876,1.7091502617958905,0.18759189217789718,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1919743481133691,-0.0043824559354719295
|
| 11 |
+
9,1,1,1.7822992862381686,1.5977715277149638,0.1845277585232048,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2135915139998379,-0.02906375547663309
|
| 12 |
+
10,2,1,1.7891142518382623,1.5368690834802268,0.25224516835803557,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.214340494464212,0.03790467389382357
|
| 13 |
+
11,3,1,1.8510493147112548,1.5542154618415602,0.29683385286969455,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19195519055650712,0.10487866231318743
|
| 14 |
+
12,4,1,1.8514970394863801,1.6533807454685636,0.1981162940178165,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21087707212585083,-0.012760778108034332
|
| 15 |
+
13,5,1,1.7813748459806213,1.5950162631743687,0.18635858280625262,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22808734812852083,-0.04172876532226821
|
| 16 |
+
14,6,1,1.8270657793330798,1.600823776068843,0.2262420032642367,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21428799966413137,0.011954003600105345
|
| 17 |
+
15,7,1,1.8289979593093413,1.5977586997417805,0.23123925956756075,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22474192795287173,0.006497331614689017
|
| 18 |
+
16,0,2,1.9259127480023568,1.7557100136281796,0.1702027343741772,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19689187892462212,-0.02668914455044491
|
| 19 |
+
17,1,2,1.8440771335590775,1.6581914063886565,0.18588572717042107,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20892797086382808,-0.023042243693407016
|
| 20 |
+
18,2,2,1.9518470227334213,1.713295643273442,0.23855137945997917,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24539056520939195,-0.0068391857494127795
|
| 21 |
+
19,3,2,1.8951096604885957,1.620354865518599,0.27475479496999666,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2152548086391135,0.05949998633088316
|
| 22 |
+
20,4,2,1.8779157282182317,1.6474651011536725,0.2304506270645592,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2105796101074482,0.01987101695711102
|
| 23 |
+
21,5,2,1.835655878992366,1.6618037401734878,0.1738521388188783,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23234303250440091,-0.05849089368552263
|
| 24 |
+
22,6,2,1.8539516313702407,1.616705089737835,0.23724654163240566,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22068077317909007,0.016565768453315588
|
| 25 |
+
23,7,2,1.8459836932167604,1.5971262957558583,0.24885739746090207,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2133289292372389,0.03552846822366318
|
| 26 |
+
24,0,3,2.03646270587468,1.8634037293425574,0.17305897653212243,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19225645881038544,-0.01919748227826301
|
| 27 |
+
25,1,3,1.8733123211001348,1.6922812616770426,0.18103105942309217,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2308916033104298,-0.04986054388733763
|
| 28 |
+
26,2,3,1.883906537024854,1.668462864890942,0.2154436721339119,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2530134601934233,-0.03756978805951139
|
| 29 |
+
27,3,3,1.9638635576163737,1.7492801155063797,0.21458344210999392,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24406136914696397,-0.029477927036970053
|
| 30 |
+
28,4,3,1.9040912204338452,1.7288575408461355,0.17523367958770963,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23202418197474572,-0.05679050238703609
|
| 31 |
+
29,5,3,1.8536507259111583,1.6891855129001463,0.16446521301101202,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.229161823369588,-0.06469661035857599
|
| 32 |
+
30,6,3,1.8906681352403525,1.664468371008272,0.22619976423208055,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23080116840155895,-0.004601404169478407
|
| 33 |
+
31,7,3,1.8862549546205394,1.6725498641587848,0.21370509046175457,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2348193579242348,-0.02111426746248024
|
| 34 |
+
32,0,4,2.1381838363097425,1.9419753507876165,0.196208485522126,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19693760685944417,-0.0007291213373181726
|
| 35 |
+
33,1,4,2.0021926480455527,1.7897546910024005,0.21243795704315227,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2254078761665912,-0.012969919123438922
|
| 36 |
+
34,2,4,1.9859499461191088,1.8140824215978448,0.17186752452126397,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2513431120831322,-0.07947558756186823
|
| 37 |
+
35,3,4,1.999037162171787,1.8138570641767906,0.18518009799499646,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23729637846118634,-0.05211628046618988
|
| 38 |
+
36,4,4,1.9922089874256195,1.8224272169140492,0.16978177051157028,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2311455752121152,-0.06136380470054492
|
| 39 |
+
37,5,4,2.0720249801280697,1.8722415227132418,0.19978345741482784,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2517742923810695,-0.051990834966241684
|
| 40 |
+
38,6,4,2.0254159682909476,1.8285143993509982,0.19690156893994937,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23614496719660405,-0.03924339825665468
|
| 41 |
+
39,7,4,1.9056364481593477,1.7195447879850367,0.186091660174311,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23309860204876598,-0.04700694187445498
|
| 42 |
+
40,0,5,2.2348401366892725,2.015293132547106,0.21954700414216655,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22725709555905627,-0.0077100914168897194
|
| 43 |
+
41,1,5,2.0874083146781492,1.871238461042107,0.21616985363604235,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2293132835270919,-0.013143429891049552
|
| 44 |
+
42,2,5,2.1434732959989544,1.9135307542096611,0.2299425417892933,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2780580072707002,-0.04811546548140688
|
| 45 |
+
43,3,5,2.095493662842464,1.8485059377927402,0.24698772504972366,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23299194585105432,0.013995779198669345
|
| 46 |
+
44,4,5,2.1021035674071102,1.8940411588679595,0.2080624085391507,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25328544965422584,-0.045223041115075135
|
| 47 |
+
45,5,5,2.1142966347782917,1.9118291008881818,0.20246753389010985,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.28342973682947337,-0.08096220293936351
|
| 48 |
+
46,6,5,2.117950472438788,1.9234370662125364,0.19451340622625168,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2566436431686705,-0.062130236942418815
|
| 49 |
+
47,7,5,2.104323171723524,1.9043028503431887,0.2000203213803351,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2523558017569687,-0.0523354803766336
|
| 50 |
+
48,0,6,2.2567259291448805,2.0405131126433433,0.21621281650153712,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2187700933525647,-0.002557276851027579
|
| 51 |
+
49,1,6,2.107253724430155,1.8453121401159618,0.26194158431419323,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23267123053198913,0.029270353782204106
|
| 52 |
+
50,2,6,2.2161657370353094,1.99672824746985,0.2194374895654594,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2896591743390502,-0.07022168477359081
|
| 53 |
+
51,3,6,2.141632513561649,1.9180060747093832,0.22362643885226596,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26289874259919666,-0.03927230374693069
|
| 54 |
+
52,4,6,2.1250965065653515,1.9095902044126725,0.21550630215267907,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24667288177881663,-0.03116657962613756
|
| 55 |
+
53,5,6,2.209461797986971,1.9559770007147559,0.25348479727221496,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27136065089625516,-0.017875853624040206
|
| 56 |
+
54,6,6,2.197360269868856,1.9840490815152436,0.2133111883536123,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2564121353807727,-0.043100947027160386
|
| 57 |
+
55,7,6,2.197792567327093,1.9926429219768917,0.2051496453502013,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2575585249255885,-0.0524088795753872
|
| 58 |
+
56,0,7,2.182672885340236,1.9987882297200883,0.18388465562014766,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22253603444718095,-0.03865137882703329
|
| 59 |
+
57,1,7,2.1541072847341907,1.937300233190589,0.21680705154360158,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24581627069597922,-0.02900921915237764
|
| 60 |
+
58,2,7,2.1507859447566218,1.9482909112731241,0.20249503348349762,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27318745085240437,-0.07069241736890675
|
| 61 |
+
59,3,7,2.136944229930074,1.9057508476836424,0.23119338224643138,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24115914810500683,-0.009965765858575448
|
| 62 |
+
60,4,7,2.1312932978759624,1.9191639380124932,0.21212935986346926,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25438892572345284,-0.04225956585998358
|
| 63 |
+
61,5,7,2.2199350036077505,1.9777851519243217,0.24214985168342884,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27477009286193077,-0.03262024117850193
|
| 64 |
+
62,6,7,2.226694632564775,2.032023350586285,0.19467128197848993,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.284334952555779,-0.08966367057728908
|
| 65 |
+
63,7,7,2.152369958888612,1.9706535151601954,0.18171644372841644,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2642412344616847,-0.08252479073326824
|
| 66 |
+
64,0,8,2.244837147323539,2.055978605783492,0.18885854154004722,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23180629469278524,-0.04294775315273802
|
| 67 |
+
65,1,8,2.159589318858656,1.9737007204894095,0.18588859836924643,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2626357817514233,-0.0767471833821769
|
| 68 |
+
66,2,8,2.2097533952220285,2.00997449644779,0.19977889877423838,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2723163945375675,-0.07253749576332913
|
| 69 |
+
67,3,8,2.2104104873871435,2.0076829334703294,0.20272755391681407,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26352586894787144,-0.06079831503105737
|
| 70 |
+
68,4,8,2.1001848615075462,1.9118508283763762,0.18833403313117003,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27141422160266027,-0.08308018847149024
|
| 71 |
+
69,5,8,2.1477754043622546,1.9661264613115257,0.18164894305072887,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2762566391783423,-0.09460769612761344
|
| 72 |
+
70,6,8,2.164413530127038,1.9702144424625605,0.19419908766447747,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2615834543941382,-0.06738436672966075
|
| 73 |
+
71,7,8,2.208405464304636,1.9726457104005282,0.23575975390410786,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.279816815518509,-0.04405706161440115
|
| 74 |
+
72,0,9,2.222206491804834,2.0504583970943164,0.17174809471051766,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23027395892797076,-0.058525864217453094
|
| 75 |
+
73,1,9,1.9738057351481213,1.7795608095996258,0.19424492554849548,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2517950281815011,-0.05755010263300564
|
| 76 |
+
74,2,9,2.190395309810258,1.986826532614409,0.20356877719584898,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27788966690832506,-0.07432088971247608
|
| 77 |
+
75,3,9,2.1443866429136635,1.9551559476248588,0.18923069528880476,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23774859434045892,-0.048517899051654156
|
| 78 |
+
76,4,9,2.113841292228842,1.9394775645110918,0.1743637277177501,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25962444265829765,-0.08526071494054754
|
| 79 |
+
77,5,9,2.1803384442655105,1.9505222961185926,0.22981614814691786,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.28387390639811105,-0.05405775825119319
|
| 80 |
+
78,6,9,2.199672990161188,1.9618078011957134,0.23786518896547437,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26368475075774134,-0.025819561792266965
|
| 81 |
+
79,7,9,2.1604047973633707,1.9489220904832787,0.21148270688009196,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2592999269849463,-0.04781722010485434
|
| 82 |
+
80,0,10,2.1384811038422034,1.963082259528311,0.1753988443138923,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22651150017134558,-0.05111265585745328
|
| 83 |
+
81,1,10,1.9734505800314122,1.77340488165005,0.2000456983813621,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2544744507671637,-0.05442875238580158
|
| 84 |
+
82,2,10,2.1471967275439776,1.9336036655956754,0.2135930619483022,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.284739273030878,-0.0711462110825758
|
| 85 |
+
83,3,10,2.1543250555982185,1.940758095406217,0.2135669601920016,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25224022481840214,-0.03867326462640053
|
| 86 |
+
84,4,10,2.1019755174327823,1.8992915956905367,0.2026839217422456,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2649428743628546,-0.06225895262060899
|
| 87 |
+
85,5,10,2.1778415613397124,1.9369295132838478,0.24091204805586464,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.28155692305575064,-0.040644874999886005
|
| 88 |
+
86,6,10,2.179040234565185,1.9356028823093276,0.2434373522558575,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24998708934394864,-0.006549737088091145
|
| 89 |
+
87,7,10,2.174849041955919,1.9199581785878332,0.254890863368086,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2774049837913153,-0.02251412042322931
|
| 90 |
+
88,0,11,2.2140768363989443,2.0278001300979582,0.18627670630098603,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22484376991317068,-0.03856706361218465
|
| 91 |
+
89,1,11,2.1019145300692244,1.839946407508124,0.26196812256110036,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2609710125060336,0.0009971100550667522
|
| 92 |
+
90,2,11,2.116910555902163,1.9109963166971002,0.20591423920506258,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2718708390907978,-0.06595659988573521
|
| 93 |
+
91,3,11,2.131132737982605,1.913096230710914,0.21803650727169077,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24465356423385032,-0.026617056962159547
|
| 94 |
+
92,4,11,2.1589621505354515,1.9320364476237006,0.22692570291175085,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26212714306943274,-0.035201440157681896
|
| 95 |
+
93,5,11,2.0653701523210564,1.8509563796017119,0.21441377271934448,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26402985922002986,-0.049616086500685386
|
| 96 |
+
94,6,11,2.1272931939981,1.9111101491742553,0.21618304482384487,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2536453368223537,-0.03746229199850881
|
| 97 |
+
95,7,11,2.164955252281234,1.9114131527054528,0.25354209957578133,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26100490499095863,-0.007462805415177298
|
| 98 |
+
96,0,12,2.1373788735930908,1.9566847586594605,0.1806941149336303,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22388744039890973,-0.04319332546527943
|
| 99 |
+
97,1,12,1.9607047944506952,1.7663711240615125,0.1943336703891827,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2530572356061349,-0.05872356521695221
|
| 100 |
+
98,2,12,2.0735738466534728,1.8090873820128288,0.26448646464064396,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25416208163311693,0.010324383007527027
|
| 101 |
+
99,3,12,2.1277316987783133,1.8631644113583956,0.26456728741991764,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2489755891922072,0.015591698227710449
|
| 102 |
+
100,4,12,2.0791648005823693,1.85293965777977,0.2262251428025992,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2378819028823036,-0.011656760079704398
|
| 103 |
+
101,5,12,2.1359129784741318,1.8723444769934816,0.26356850148065014,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26774446991290146,-0.00417596843225132
|
| 104 |
+
102,6,12,2.1575221803148055,1.8571427615931182,0.3003794187216873,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26810115202233264,0.03227826669935463
|
| 105 |
+
103,7,12,2.1455756523397254,1.839194885950148,0.30638076638957745,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25181142304942017,0.054569343340157284
|
| 106 |
+
104,0,13,2.1192408214012715,1.942932636463222,0.17630818493804945,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22535041269349798,-0.04904222775544853
|
| 107 |
+
105,1,13,1.943313609184759,1.7580885956507135,0.1852250135340454,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23031329406449075,-0.045088280530445335
|
| 108 |
+
106,2,13,2.1046232457286798,1.8548028430251062,0.24982040270357353,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25983497560822943,-0.010014572904655905
|
| 109 |
+
107,3,13,2.1063043035281632,1.8548206319746867,0.2514836715534765,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24453590278495296,0.006947768768523543
|
| 110 |
+
108,4,13,2.0505227814669302,1.8350185539421706,0.21550422752475962,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23523547682506285,-0.019731249300303233
|
| 111 |
+
109,5,13,2.10028455079966,1.8361075284711827,0.2641770223284772,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26347040473173755,0.0007066175967396227
|
| 112 |
+
110,6,13,2.1007031993454683,1.7983272658867828,0.3023759334586855,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24525787188702752,0.057118061571657996
|
| 113 |
+
111,7,13,2.0658969479886693,1.7933021621026501,0.27259478588601915,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2526352846771367,0.019959501208882457
|
| 114 |
+
112,0,14,2.118438076482435,1.936750923639209,0.18168715284322579,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2292853286428842,-0.047598175799658415
|
| 115 |
+
113,1,14,1.9371081673310069,1.7601775453949575,0.17693062193604936,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23669389199910662,-0.05976327006305726
|
| 116 |
+
114,2,14,2.0254358288779057,1.7821354881971996,0.24330034068070616,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2583837855579201,-0.015083444877213914
|
| 117 |
+
115,3,14,2.096092272887466,1.838494562085326,0.2575977108021401,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23828447424675425,0.01931323655538586
|
| 118 |
+
116,4,14,2.0718155618858747,1.8652414811036842,0.20657408078219053,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24891263297362665,-0.04233855219143612
|
| 119 |
+
117,5,14,2.0993092060787,1.8639590214456963,0.23535018463300394,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26472857888545986,-0.02937839425245592
|
| 120 |
+
118,6,14,2.0671806309323335,1.7924771338120746,0.2747034971202589,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25671635747993093,0.017987139640327943
|
| 121 |
+
119,7,14,1.9627156999215891,1.7406163423720353,0.2220993575495538,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2449450558991797,-0.02284569834962591
|
| 122 |
+
120,0,15,2.044333459529205,1.8942044984221806,0.15012896110702423,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21871761370218246,-0.06858865259515823
|
| 123 |
+
121,1,15,1.934682503989863,1.7554788857301429,0.1792036182597201,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23330186451603696,-0.05409824625631687
|
| 124 |
+
122,2,15,2.075624190929138,1.8534969335436844,0.2221272573854538,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25637340049195445,-0.03424614310650065
|
| 125 |
+
123,3,15,2.045393386954987,1.8333670438848237,0.21202634307016321,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22761109195898865,-0.01558474888882544
|
| 126 |
+
124,4,15,2.0517947380561017,1.828254016174538,0.2235407218815637,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23417740109512675,-0.010636679213563038
|
| 127 |
+
125,5,15,2.0802742966770706,1.8579976701595817,0.22227662651748892,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2529131177398125,-0.030636491222323592
|
| 128 |
+
126,6,15,1.9977587815789657,1.7775676782751444,0.2201911033038213,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2390587042913337,-0.01886760098751239
|
| 129 |
+
127,7,15,1.9485551510635026,1.738530405545318,0.21002474551818473,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24296389646910344,-0.032939150950918705
|
| 130 |
+
128,0,16,2.0614038467929072,1.9106694962995412,0.15073435049336603,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19789000322411443,-0.0471556527307484
|
| 131 |
+
129,1,16,1.8896063194363346,1.715784821424489,0.17382149801184554,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2321962698281923,-0.05837477181634676
|
| 132 |
+
130,2,16,2.027067016421088,1.7982922299137614,0.22877478650732685,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24064441809798964,-0.011869631590662788
|
| 133 |
+
131,3,16,2.0284233139409937,1.7979947909125524,0.2304285230284413,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2306720273854197,-0.00024350435697839679
|
| 134 |
+
132,4,16,2.0229125181474354,1.7774610854199664,0.24545143272746905,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22440161193829744,0.021049820789171614
|
| 135 |
+
133,5,16,1.9688343424920192,1.769615315789876,0.1992190267021432,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23418280133556957,-0.03496377463342637
|
| 136 |
+
134,6,16,2.007501882370696,1.749532504928823,0.257969377441873,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24021318308523876,0.017756194356634225
|
| 137 |
+
135,7,16,2.027810474316777,1.7654728942879003,0.26233758002887675,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24739128395420762,0.01494629607466913
|
| 138 |
+
136,0,17,2.068198470793856,1.921819727482331,0.14637874331152512,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20196061362255002,-0.055581870311024906
|
| 139 |
+
137,1,17,1.871542826678271,1.7267668324440184,0.14477599423425258,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21522031219133209,-0.0704443179570795
|
| 140 |
+
138,2,17,1.929919131395312,1.7044385274836027,0.2254806039117092,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24009595708357967,-0.01461535317187046
|
| 141 |
+
139,3,17,2.0001514324412226,1.7190270394163023,0.2811243930249203,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2166014604950146,0.06452293252990571
|
| 142 |
+
140,4,17,1.9681336308787543,1.7223126432411295,0.24582098763762472,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2236360632226615,0.022184924414963225
|
| 143 |
+
141,5,17,1.9669420227484984,1.7287556675226992,0.23818635522579923,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2247167171800919,0.013469638045707333
|
| 144 |
+
142,6,17,2.0030605119113956,1.7830035137111337,0.2200569982002618,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24321161192369956,-0.023154613723437745
|
| 145 |
+
143,7,17,1.9917360562167652,1.7352761706824602,0.256459885534305,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23672863510857578,0.019731250425729208
|
| 146 |
+
144,0,18,1.978955421698938,1.8475454175536519,0.13141000414528614,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19680461903446522,-0.06539461488917908
|
| 147 |
+
145,1,18,1.8620998070830292,1.71578435640792,0.1463154506751092,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20984303142318184,-0.06352758074807263
|
| 148 |
+
146,2,18,1.9218286050661284,1.6833972188801578,0.2384313861859706,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2337467063781673,0.004684679807803294
|
| 149 |
+
147,3,18,1.9264766798585924,1.6704762027370812,0.2560004771215112,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19992850890434144,0.056071968217169754
|
| 150 |
+
148,4,18,1.9989758362958976,1.7228777107967617,0.2760981254991359,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2320375655132505,0.04406055998588543
|
| 151 |
+
149,5,18,1.8727852851010163,1.6664209113278148,0.2063643737732015,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23850603606362708,-0.03214166229042559
|
| 152 |
+
150,6,18,1.9498685586042406,1.712506618397163,0.23736194020707768,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22764906694206988,0.009712873265007804
|
| 153 |
+
151,7,18,1.898986448048181,1.6802427830366962,0.2187436650114849,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22331731254542642,-0.004573647533941516
|
| 154 |
+
152,0,19,2.021102138837905,1.8707529009510275,0.1503492378868776,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1895513211456894,-0.039202083258811804
|
| 155 |
+
153,1,19,1.8598380926837919,1.7104412592087948,0.1493968334749971,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22443817258593657,-0.07504133911093946
|
| 156 |
+
154,2,19,1.9943241186433855,1.703224298818337,0.2910998198250485,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.244574307320103,0.04652551250494552
|
| 157 |
+
155,3,19,1.8994570874956902,1.6125137935795668,0.2869432939161234,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19249286763678541,0.09445042627933797
|
| 158 |
+
156,4,19,1.9618294688789046,1.7225134091247998,0.23931605975410486,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22090318487998317,0.018412874874121687
|
| 159 |
+
157,5,19,1.8377087889483736,1.6508679720051085,0.18684081694326515,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2356592142443077,-0.04881839730104254
|
| 160 |
+
158,6,19,1.8686535667593662,1.6421237575059169,0.22652980925344934,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21738829312311436,0.009141516130334981
|
| 161 |
+
159,7,19,1.8683451442263863,1.6338260557877162,0.2345190884386701,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21679674655450798,0.017722341884162107
|
| 162 |
+
160,0,20,1.921692599570596,1.7575877949475864,0.16410480462300958,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19050554226947258,-0.026400737646463
|
| 163 |
+
161,1,20,1.8184738708722095,1.6452358246214458,0.17323804625076367,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22835119594801023,-0.055113149697246566
|
| 164 |
+
162,2,20,1.7922447210226609,1.6144481028828597,0.1777966181398012,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22403185228023714,-0.046235234140435955
|
| 165 |
+
163,3,20,1.8518943506001366,1.6276734333083194,0.22422091729181726,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2169149917482609,0.0073059255435563575
|
| 166 |
+
164,4,20,1.7845803571865606,1.6290368729791083,0.15554348420745234,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2146301706605367,-0.05908668645308435
|
| 167 |
+
165,5,20,1.8313097135628567,1.663652828449792,0.16765688511306465,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21733119055342187,-0.049674305440357225
|
| 168 |
+
166,6,20,1.8232638759743758,1.6365565751537783,0.1867073008205975,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2134553469378888,-0.026748046117291313
|
| 169 |
+
167,7,20,1.8198905131701064,1.6043239930704118,0.21556652009969457,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20586096295367584,0.009705557146018728
|
| 170 |
+
168,0,21,1.9171966140591092,1.753050256409588,0.16414635764952124,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19105109991073266,-0.026904742261211423
|
| 171 |
+
169,1,21,1.78261033163168,1.6099974748835,0.17261285674817994,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21325577491228676,-0.04064291816410681
|
| 172 |
+
170,2,21,1.7430784557985657,1.5507225336743151,0.19235592212425057,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21167310321206867,-0.019317181087818103
|
| 173 |
+
171,3,21,1.8134986456541147,1.606176403082389,0.2073222425717256,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21764963955777095,-0.010327396986045345
|
| 174 |
+
172,4,21,1.760081842495601,1.5842283584400365,0.17585348405556456,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20331791804862176,-0.027464433993057202
|
| 175 |
+
173,5,21,1.7746925217163487,1.6047592361924772,0.16993328552387155,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21128529899699178,-0.04135201347312023
|
| 176 |
+
174,6,21,1.8180644994119253,1.6013957265294052,0.21666877288252007,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2107614536801381,0.0059073192023819665
|
| 177 |
+
175,7,21,1.8171811502107365,1.5760196795293564,0.24116147068138005,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21915619190952684,0.02200527877185321
|
| 178 |
+
176,0,22,1.7738031929489044,1.5923907985528827,0.18141239439602175,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.168105169206344,0.013307225189677752
|
| 179 |
+
177,1,22,1.752191319535178,1.560189149519348,0.19200217001582986,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20275917190318005,-0.010757001887350182
|
| 180 |
+
178,2,22,1.737216131543604,1.5276167933906122,0.20959933815299192,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21302423319203245,-0.003424895039040532
|
| 181 |
+
179,3,22,1.7971139652095716,1.56498066392179,0.23213330128778153,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20286570958737027,0.029267591700411266
|
| 182 |
+
180,4,22,1.763440995998288,1.5775962049080192,0.18584479109026875,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19530510987453753,-0.009460318784268784
|
| 183 |
+
181,5,22,1.7724943406166247,1.5848251168132002,0.18766922380342455,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2198576088813411,-0.03218838507791655
|
| 184 |
+
182,6,22,1.806402451389507,1.5768236926999004,0.22957875868960653,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20708754649817784,0.02249121219142869
|
| 185 |
+
183,7,22,1.8061093221331128,1.5576276636683704,0.24848165846474246,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20724319758167575,0.04123846088306671
|
| 186 |
+
184,0,23,1.8523339239563061,1.667573230632836,0.18476069332347023,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19337737254318998,-0.008616679219719758
|
| 187 |
+
185,1,23,1.748306439557021,1.5567994344633687,0.19150700509365226,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19560470804943142,-0.004097702955779159
|
| 188 |
+
186,2,23,1.740945509602268,1.518160572703018,0.22278493689924983,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20202150106288497,0.020763435836364863
|
| 189 |
+
187,3,23,1.8098615982264028,1.5679215155154393,0.24194008271096346,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21630147549458267,0.025638607216380782
|
| 190 |
+
188,4,23,1.7528003149292306,1.5610695899638622,0.19173072496536836,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20680370358313338,-0.01507297861776502
|
| 191 |
+
189,5,23,1.7448123605292316,1.5359901346349043,0.2088222258943273,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19151914324870267,0.017303082645624634
|
| 192 |
+
190,6,23,1.8117495794999727,1.547812987054262,0.26393659244571066,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2120047594742478,0.051931832971462866
|
| 193 |
+
191,7,23,1.8079260886772068,1.5489169954940385,0.25900909318316834,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2037144699344109,0.055294623248757446
|
| 194 |
+
192,0,24,1.7930558215356391,1.6122338064595805,0.18082201507605866,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.18341218425156702,-0.002590169175508361
|
| 195 |
+
193,1,24,1.7574129996764163,1.5698464274867956,0.1875665721896207,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20861615676601986,-0.02104958457639916
|
| 196 |
+
194,2,24,1.7493532724685346,1.5234650494896358,0.22588822297889877,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2230788786904787,0.002809344288420057
|
| 197 |
+
195,3,24,1.8085126776122251,1.5608659217494298,0.24764675586279528,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19793324187812722,0.049713513984668056
|
| 198 |
+
196,4,24,1.775439738931532,1.584086060580122,0.19135367835141004,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2050746818771163,-0.013721003525706266
|
| 199 |
+
197,5,24,1.7741407715054276,1.5732433562625778,0.20089741524284976,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2167976433671992,-0.015900228124349436
|
| 200 |
+
198,6,24,1.8117082464144942,1.5521522430111687,0.2595560034033255,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20846673158461604,0.05108927181870948
|
| 201 |
+
199,7,24,1.8142510128609242,1.5536123465910538,0.2606386662698703,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19600836352808604,0.06463030274178427
|
| 202 |
+
200,0,25,1.81158461391178,1.635597033351394,0.17598758056038588,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1823887719076338,-0.006401191347247925
|
| 203 |
+
201,1,25,1.778776693788385,1.5971361236747506,0.18164057011363455,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20560825811506778,-0.02396768800143323
|
| 204 |
+
202,2,25,1.8482129861373782,1.5963513586668703,0.2518616274705079,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22141257149072358,0.030449055979784312
|
| 205 |
+
203,3,25,1.8401049474898183,1.582427247822965,0.2576776996668533,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20697314458078075,0.05070455508607252
|
| 206 |
+
204,4,25,1.8791109241856894,1.6430788564088317,0.2360320677768577,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22653062326395568,0.009501444512902024
|
| 207 |
+
205,5,25,1.7810816652128054,1.5950162631743687,0.1860654020384367,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22844339562800364,-0.042377993589566954
|
| 208 |
+
206,6,25,1.819638741397148,1.5843999615288666,0.23523877986828134,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2109853902386758,0.02425338962960555
|
| 209 |
+
207,7,25,1.8283338825690165,1.6059895039405714,0.22234437862844514,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21415521994037934,0.0081891586880658
|
| 210 |
+
208,0,26,1.932516013053008,1.7716344783292677,0.16088153472374023,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19112125530729296,-0.03023972058355273
|
| 211 |
+
209,1,26,1.8286634002686615,1.6247673458430392,0.2038960544256223,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21261879143299,-0.008722737007367698
|
| 212 |
+
210,2,26,1.863598733427103,1.6128790517346285,0.2507196816924744,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22649064722512113,0.02422903446735325
|
| 213 |
+
211,3,26,1.938436163576505,1.6903088903060293,0.2481272732704758,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2188623792064346,0.029264894064041203
|
| 214 |
+
212,4,26,1.9326570536001686,1.7353125814838144,0.1973444721163542,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2435197013386834,-0.046175229222329195
|
| 215 |
+
213,5,26,1.8405272309933332,1.6667366833581467,0.17379054763518642,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23831165610986038,-0.06452110847467396
|
| 216 |
+
214,6,26,1.8719866051984038,1.6009896806591641,0.2709969245392396,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2059203186781724,0.06507660586106723
|
| 217 |
+
215,7,26,1.8447209819308248,1.6012457053351181,0.24347527659570667,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21923364542959645,0.024241631166110222
|
| 218 |
+
216,0,27,1.9749621493908411,1.805625953326612,0.16933619606422923,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1798755576217852,-0.01053936155755597
|
| 219 |
+
217,1,27,1.849676066508144,1.671702513742424,0.17797355276572002,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22110650325553194,-0.043132950489811916
|
| 220 |
+
218,2,27,1.893527564575382,1.6690659249547373,0.2244616396206447,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2325752222398687,-0.008113582619224013
|
| 221 |
+
219,3,27,1.921364533662721,1.6778405887508974,0.2435239449118236,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20784613791640538,0.035677806995418226
|
| 222 |
+
220,4,27,1.9141724201795025,1.6815181151531244,0.23265430502637807,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21517940062089136,0.017474904405486713
|
| 223 |
+
221,5,27,1.90071273762732,1.7373416818855432,0.1633710557417769,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24329805616136868,-0.07992700041959178
|
| 224 |
+
222,6,27,1.991262554697738,1.726162772573975,0.26509978212376306,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23019986062998732,0.03489992149377574
|
| 225 |
+
223,7,27,1.8819749505550962,1.6636728637533529,0.21830208680174334,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23166275563895833,-0.013360668837214984
|
| 226 |
+
224,0,28,2.1193020069314907,1.9038235126743621,0.21547849425712862,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19528415373219987,0.020194340524928744
|
| 227 |
+
225,1,28,1.9293423958523852,1.7202094159746224,0.2091329798777628,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22450725831471496,-0.01537427843695216
|
| 228 |
+
226,2,28,1.9912019899312157,1.8255308345308403,0.16567115540037536,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2632502220377335,-0.09757906663735816
|
| 229 |
+
227,3,28,1.9757802045742647,1.7883656158411316,0.1874145887331331,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22727638249076954,-0.03986179375763643
|
| 230 |
+
228,4,28,2.033842190940091,1.8491769106698297,0.18466528027026152,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23838406908508114,-0.05371878881481962
|
| 231 |
+
229,5,28,2.0777273278279287,1.869131783524103,0.20859554430382565,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2530530997790812,-0.04445755547525554
|
| 232 |
+
230,6,28,2.017952812537273,1.8331427564089633,0.18481005612830992,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23833264777741037,-0.05352259164910045
|
| 233 |
+
231,7,28,2.0101393729181356,1.8193497985817193,0.1907895743364163,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22799814022983367,-0.03720856589341737
|
| 234 |
+
232,0,29,2.2348401366892725,2.015293132547106,0.21954700414216655,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2208265201027979,-0.001279515960631361
|
| 235 |
+
233,1,29,2.139131132463647,1.934294617309576,0.20483651515407097,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25061391898118024,-0.045777403827109264
|
| 236 |
+
234,2,29,2.1909844200572715,1.9374654828937743,0.25351893716349716,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2580068833967881,-0.0044879462332909625
|
| 237 |
+
235,3,29,2.140907076571461,1.8995120549022797,0.24139502166918136,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24083746440397902,0.0005575572652023464
|
| 238 |
+
236,4,29,2.068448804953368,1.8439874335358994,0.22446137141746858,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2327079216372374,-0.008246550219768833
|
| 239 |
+
237,5,29,2.169997702435507,1.9230390283793635,0.24695867405614358,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2596378502026748,-0.012679176146531246
|
| 240 |
+
238,6,29,2.1002968549658547,1.9141746075709924,0.18612224739486227,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24523889704677115,-0.05911664965190888
|
| 241 |
+
239,7,29,2.12785042210458,1.9287329410559295,0.19911748104865068,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24850175418599396,-0.04938427313734328
|
| 242 |
+
240,0,30,2.2567259291448805,2.0405131126433433,0.21621281650153712,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21736226236001843,-0.0011494458584813128
|
| 243 |
+
241,1,30,2.1267263130403524,1.9068153423305656,0.21991097070978682,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23658457145920075,-0.01667360074941393
|
| 244 |
+
242,2,30,2.138606182011528,1.9299233614777251,0.20868282053380272,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.277547462369939,-0.06886464183613628
|
| 245 |
+
243,3,30,2.141632513561649,1.9180060747093832,0.22362643885226596,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25321407775679083,-0.02958763890452487
|
| 246 |
+
244,4,30,2.0974023171463543,1.86914016251771,0.2282621546286443,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2521492117489337,-0.02388705712028938
|
| 247 |
+
245,5,30,2.128747807317552,1.9111057214363232,0.2176420858812289,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2847096107587035,-0.06706752487747458
|
| 248 |
+
246,6,30,2.173656394890259,1.967172906088407,0.20648348880185208,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2732032954067236,-0.06671980660487153
|
| 249 |
+
247,7,30,2.201679263866712,1.9845687248409132,0.2171105390257988,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26755941865178823,-0.05044887962598943
|
| 250 |
+
248,0,31,2.2587293045864287,2.0587220095412633,0.20000729504516546,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22020466976432673,-0.020197374719161276
|
| 251 |
+
249,1,31,2.206054774649956,2.011294961892767,0.194759812757189,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2654110384644617,-0.07065122570727267
|
| 252 |
+
250,2,31,2.2430374237022144,2.0160972635377044,0.22694016016451002,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2765802897018612,-0.049640129537351196
|
| 253 |
+
251,3,31,2.177475164532944,1.9518613286536506,0.2256138358792934,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24195612570221803,-0.016342289822924627
|
| 254 |
+
252,4,31,2.1365517649153327,1.9311033931833257,0.20544837173200703,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27148421356585484,-0.06603584183384781
|
| 255 |
+
253,5,31,2.1365517649153327,1.9225807231903367,0.21397104172499604,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2557877252411047,-0.04181668351610868
|
| 256 |
+
254,6,31,2.2255614690588823,2.0332766964006628,0.19228477265821953,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2800281263832849,-0.08774335372506537
|
| 257 |
+
255,7,31,2.20468166619822,2.006403402461213,0.19827826373700708,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26127296852832993,-0.06299470479132285
|
| 258 |
+
256,0,32,2.2453574148302677,2.0592798445382057,0.18607757029206207,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23986643944267616,-0.053788869150614094
|
| 259 |
+
257,1,32,2.1525899951571614,1.9625931623645947,0.18999683279256674,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26412347691794147,-0.07412664412537473
|
| 260 |
+
258,2,32,2.215028266153167,2.0106237475339652,0.20440451861920161,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2689510317527368,-0.06454651313353521
|
| 261 |
+
259,3,32,2.1546282972612265,1.963277284551412,0.19135101270981458,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24328950431360896,-0.05193849160379438
|
| 262 |
+
260,4,32,2.1199420073848354,1.9479677538905336,0.17197425349430184,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27319368620705786,-0.10121943271275602
|
| 263 |
+
261,5,32,2.199449111603702,1.9738340703242099,0.22561504127949195,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2927479632400831,-0.06713292196059117
|
| 264 |
+
262,6,32,2.232685877916824,2.0273959880003662,0.2052898899164579,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2584981040090466,-0.05320821409258869
|
| 265 |
+
263,7,32,2.1093122354247607,1.9319942028249,0.17731803259986068,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2410119955744583,-0.06369396297459762
|
| 266 |
+
264,0,33,2.222206491804834,2.0504583970943164,0.17174809471051766,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23170842414053694,-0.05996032943001928
|
| 267 |
+
265,1,33,2.1413639426742446,1.9356122624512342,0.20575168022301038,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2659617063590942,-0.06021002613608384
|
| 268 |
+
266,2,33,2.2106923133771454,1.9918698136489268,0.21882249972821866,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2764499525317188,-0.05762745280350012
|
| 269 |
+
267,3,33,2.1501235917967603,1.9456799225379906,0.20444366925876967,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24894317544565192,-0.044499506186882254
|
| 270 |
+
268,4,33,2.102593310388271,1.9088047287516692,0.19378858163660162,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2584814032141183,-0.06469282157751666
|
| 271 |
+
269,5,33,2.1418240617860382,1.9411197710262964,0.20070429075974183,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25973869291236973,-0.059034402152627896
|
| 272 |
+
270,6,33,2.2236745272076006,1.9956843435369485,0.22799018367065216,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2586224066728957,-0.030632223002243553
|
| 273 |
+
271,7,33,2.1512792911333007,1.926170434076263,0.22510885705703765,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2702544471393613,-0.04514559008232366
|
| 274 |
+
272,0,34,2.152638518623152,1.974020108252531,0.17861841037062098,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2251642295207421,-0.046545819150121126
|
| 275 |
+
273,1,34,2.1437961583583642,1.9314081561052217,0.21238800225314258,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2564385790497523,-0.04405057679660973
|
| 276 |
+
274,2,34,2.1205914601928697,1.9201545852897648,0.2004368749031049,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26983979880513,-0.06940292390202507
|
| 277 |
+
275,3,34,2.1635952373005614,1.9468969818736515,0.2166982554269099,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24723419342070163,-0.03053593799379173
|
| 278 |
+
276,4,34,2.0959528372877747,1.8872534989312808,0.2086993383564939,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24066309559356402,-0.03196375723707012
|
| 279 |
+
277,5,34,2.161748790410883,1.9286046075102754,0.2331441829006078,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2635152431418759,-0.030371060241268122
|
| 280 |
+
278,6,34,2.144813148629392,1.9265328748509265,0.21828027377846548,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2562870917097104,-0.03800681793124494
|
| 281 |
+
279,7,34,2.1361393676627505,1.8726452414495547,0.2634941262131958,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26128108203055134,0.0022130441826444525
|
| 282 |
+
280,0,35,2.198467111899627,1.9907106646179895,0.20775644728163734,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24167587120569856,-0.03391942392406122
|
| 283 |
+
281,1,35,1.968487495097041,1.7727663293172948,0.1957211657797462,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24227164117211974,-0.04655047539237356
|
| 284 |
+
282,2,35,2.135895826970737,1.923362036288576,0.21253379068216094,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.26315661998230766,-0.05062282930014672
|
| 285 |
+
283,3,35,2.158608781533106,1.9357044907123881,0.22290429082071772,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25793405413873205,-0.03502976331801433
|
| 286 |
+
284,4,35,2.158312434185982,1.926847006480853,0.2314654277051289,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2706595658190727,-0.03919413811394379
|
| 287 |
+
285,5,35,2.1454594683206176,1.9267983730979175,0.21866109522270016,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2678936659917879,-0.04923257076908771
|
| 288 |
+
286,6,35,2.161360773965447,1.8842796189107882,0.2770811550546588,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2718185273641056,0.00526262769055319
|
| 289 |
+
287,7,35,2.1497000754565723,1.8686379247438167,0.28106215071275553,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.27652060748672636,0.004541543226029177
|
| 290 |
+
288,0,36,2.155623775982284,1.9569629199499037,0.19866085603238037,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21084662300035806,-0.012185766967977685
|
| 291 |
+
289,1,36,1.9607047944506952,1.7663711240615125,0.1943336703891827,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25491771789490847,-0.06058404750572577
|
| 292 |
+
290,2,36,2.083911216339682,1.813334807774368,0.27057640856531373,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2770305585632613,-0.006454149997947578
|
| 293 |
+
291,3,36,2.1187500504183037,1.856969491827753,0.2617805585905506,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23578296710216673,0.025997591488383875
|
| 294 |
+
292,4,36,2.14799838614715,1.8736570460010387,0.27434134014611145,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2577933178583445,0.016548022287766972
|
| 295 |
+
293,5,36,2.1352099055226486,1.8450886154848596,0.29012129003778897,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.258361145261536,0.031760144776252996
|
| 296 |
+
294,6,36,2.1217421900366022,1.826120750476005,0.29562143956059717,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24502365022432548,0.05059778933627168
|
| 297 |
+
295,7,36,1.994698828570754,1.766767722931442,0.22793110563931207,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2532181714316235,-0.025287065792311436
|
| 298 |
+
296,0,37,2.1007011824581725,1.9182200429836527,0.18248113947451983,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23148558484843051,-0.04900444537391069
|
| 299 |
+
297,1,37,1.941122389004374,1.7558973754703284,0.18522501353404563,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2503705384193873,-0.06514552488534164
|
| 300 |
+
298,2,37,2.0571477721836064,1.8044108138862474,0.2527369582973591,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25965190053103826,-0.006914942233679167
|
| 301 |
+
299,3,37,1.9804685011878633,1.7827241630802466,0.1977443381076167,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24164488667548034,-0.04390054856786363
|
| 302 |
+
300,4,37,2.1045617804941186,1.8435828051259069,0.2609789753682117,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24688706509529723,0.014091910272914454
|
| 303 |
+
301,5,37,2.0948804973860473,1.8352017052849057,0.25967879210114164,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25876323865811846,0.0009155534430231871
|
| 304 |
+
302,6,37,2.091175086076905,1.8130955292642745,0.2780795568126304,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23781323110238395,0.040266325710246464
|
| 305 |
+
303,7,37,2.0981076471779208,1.801036644407652,0.29707100277026877,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25733465137295997,0.0397363513973088
|
| 306 |
+
304,0,38,2.1047425456180267,1.9357480134275729,0.1689945321904538,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22374075751638478,-0.054746225325930986
|
| 307 |
+
305,1,38,1.9343974923476872,1.7496018363277952,0.184795656019892,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2182916029955273,-0.03349594697563529
|
| 308 |
+
306,2,38,2.008493979044867,1.779497973793798,0.2289960052510691,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2457084260462974,-0.016712420795228278
|
| 309 |
+
307,3,38,2.0937700422121677,1.8416550146460153,0.25211502756615234,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24437725551078993,0.007737772055362413
|
| 310 |
+
308,4,38,2.1092820042160887,1.8677543426173489,0.24152766159873984,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2586293914680704,-0.017101729869330562
|
| 311 |
+
309,5,38,2.0874527567002588,1.8529114150260289,0.2345413416742299,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24384966589050805,-0.009308324216278141
|
| 312 |
+
310,6,38,2.116725970805791,1.8311584500823563,0.2855675207234347,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2552517436208468,0.030315777102587926
|
| 313 |
+
311,7,38,2.0795978744706325,1.7932993140107627,0.2862985604598698,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24934781980416187,0.036950740655707914
|
| 314 |
+
312,0,39,2.109162294527454,1.9377550175401423,0.17140727698731162,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22855228654513726,-0.05714500955782564
|
| 315 |
+
313,1,39,1.953855179088278,1.7566522408837872,0.19720293820449086,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2424370073188291,-0.04523406911433825
|
| 316 |
+
314,2,39,2.0697069354167663,1.8461600082550302,0.22354692716173608,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25114823642585193,-0.02760130926411586
|
| 317 |
+
315,3,39,2.0565653313385326,1.8361781129714418,0.22038721836709074,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23413960483331286,-0.013752386466222122
|
| 318 |
+
316,4,39,2.047053834271144,1.8568544947783903,0.19019933949275392,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22847287002418404,-0.03827353053143012
|
| 319 |
+
317,5,39,1.9915432225866199,1.8040070683208278,0.18753615426579207,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2515202696188681,-0.06398411535307602
|
| 320 |
+
318,6,39,2.050074037156804,1.8249528638049064,0.2251211733518974,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24064715656742242,-0.015525983215525008
|
| 321 |
+
319,7,39,2.05534081907778,1.792269433422947,0.263071385654833,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24277495338537602,0.020296432269456988
|
| 322 |
+
320,0,40,2.0770506137116973,1.923216150670866,0.15383446304083126,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20518513274709416,-0.0513506697062629
|
| 323 |
+
321,1,40,1.8896063194363346,1.721103680997312,0.1685026384390227,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2224572836289378,-0.05395464518991511
|
| 324 |
+
322,2,40,1.9459817208136418,1.731944972429255,0.2140367483843868,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24770826990706163,-0.03367152152267483
|
| 325 |
+
323,3,40,2.014927082676135,1.7851375629899344,0.22978951968620054,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22939733521331318,0.000392184472887358
|
| 326 |
+
324,4,40,2.0011290987834798,1.7917160508192733,0.20941304796420646,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23046121619352045,-0.02104816822931399
|
| 327 |
+
325,5,40,2.031019626388347,1.7783265140778621,0.25269311231048497,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24340635206655925,0.009286760243925718
|
| 328 |
+
326,6,40,1.985332444996173,1.7531721196310783,0.23216032536509457,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22599105282452459,0.006169272540569981
|
| 329 |
+
327,7,40,1.9333644308582794,1.714308288493792,0.21905614236448745,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23706202711924163,-0.018005884754754176
|
| 330 |
+
328,0,41,2.054156662432634,1.909273073111006,0.14488358932162804,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20318869232770664,-0.05830510300607861
|
| 331 |
+
329,1,41,1.875609810345616,1.7270029597791154,0.14860685056650058,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2272767381806413,-0.07866988761414073
|
| 332 |
+
330,2,41,2.0250825701454884,1.771269371745711,0.25381319839977734,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23030858770840967,0.023504610691367667
|
| 333 |
+
331,3,41,2.0417872193950397,1.7746887833794873,0.2670984360155524,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2394373161493255,0.02766111986622688
|
| 334 |
+
332,4,41,2.0176873356939993,1.7602304878086539,0.2574568478853454,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2345466600034023,0.0229101878819431
|
| 335 |
+
333,5,41,1.9822611821581948,1.7415242158560236,0.24073696630217123,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.25312564183711395,-0.012388675534942717
|
| 336 |
+
334,6,41,1.9944192262949194,1.7414368485054577,0.25298237778946175,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23374973726112214,0.019232640528339617
|
| 337 |
+
335,7,41,1.922325449422334,1.6868635161952312,0.23546193322710285,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21590056918149236,0.019561364045610485
|
| 338 |
+
336,0,42,2.0245566067383955,1.8872158647348296,0.13734074200356594,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2052400593150061,-0.06789931731144017
|
| 339 |
+
337,1,42,1.940615004007179,1.7541312643587332,0.18648373964844578,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2254824604476353,-0.038998720799189535
|
| 340 |
+
338,2,42,1.919602198955134,1.6831354285556936,0.2364667703994403,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22142907290745262,0.01503769749198769
|
| 341 |
+
339,3,42,1.9857299262228416,1.6936745212949351,0.2920554049279065,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21845054057648317,0.07360486435142333
|
| 342 |
+
340,4,42,1.9625509136912034,1.7335157773155907,0.22903513637561268,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22541990856647853,0.003615227809134147
|
| 343 |
+
341,5,42,2.0042553211311644,1.7545887773378563,0.2496665437933081,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24512344042202994,0.004543103371278168
|
| 344 |
+
342,6,42,1.8893163635140922,1.6779111387708006,0.2114052247432916,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21896822349987244,-0.007562998756580841
|
| 345 |
+
343,7,42,1.9281575626336669,1.7048270600495168,0.2233305025841501,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22637898242778598,-0.003048479843635876
|
| 346 |
+
344,0,43,1.998097224917439,1.8505661307735537,0.1475310941438852,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.18351522407915422,-0.035984129935269005
|
| 347 |
+
345,1,43,1.8372154289430067,1.694150492221146,0.1430649367218606,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2051159566216103,-0.062051019899749704
|
| 348 |
+
346,2,43,1.850197239782755,1.628336982911803,0.221860256870952,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22589256315111195,-0.004032306280159936
|
| 349 |
+
347,3,43,1.9701267660888324,1.6822532507515777,0.2878735153372547,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21616289868752792,0.07171061664972678
|
| 350 |
+
348,4,43,1.9501509800082135,1.7026089710641343,0.24754200894407918,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21555740980706029,0.0319845991370189
|
| 351 |
+
349,5,43,1.9959193080638233,1.7086276475556716,0.2872916605081517,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2341657397349437,0.05312592077320799
|
| 352 |
+
350,6,43,1.9348251624028656,1.6876336022438185,0.24719156015904709,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22362327797188764,0.02356828218715945
|
| 353 |
+
351,7,43,1.865332376657244,1.6318044859939724,0.23352789066327162,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21632711608984057,0.017200774573431055
|
| 354 |
+
352,0,44,1.9841255095132961,1.8112170061910633,0.17290850332223284,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1968454608917778,-0.023936957569544948
|
| 355 |
+
353,1,44,1.806190739846428,1.6236142769614452,0.18257646288498286,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2165278307683598,-0.03395136788337694
|
| 356 |
+
354,2,44,1.8222965987162443,1.6200415012821718,0.20225509743407244,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.24429313310377454,-0.0420380356697021
|
| 357 |
+
355,3,44,1.8094410277853226,1.6104793094639533,0.19896171832136922,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2070314732811671,-0.008069754959797892
|
| 358 |
+
356,4,44,1.8883759873173358,1.646594647146203,0.24178134017113284,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1985945192363625,0.04318682093477033
|
| 359 |
+
357,5,44,1.7728319812943958,1.5983163385297448,0.17451564276465104,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20816569940095042,-0.033650056636299386
|
| 360 |
+
358,6,44,1.8227087594366918,1.6185549948034743,0.20415376463321744,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21255382755908903,-0.008400062925871588
|
| 361 |
+
359,7,44,1.8174256058502993,1.6008625847897964,0.21656302106050296,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2023469164420324,0.01421610461847056
|
| 362 |
+
360,0,45,1.869527399235892,1.674145663078719,0.19538173615717302,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1820882059775446,0.013293530179628421
|
| 363 |
+
361,1,45,1.7547038334612766,1.5735184380362475,0.1811853954250291,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19688588809257968,-0.01570049266755058
|
| 364 |
+
362,2,45,1.802363564015986,1.60067383568113,0.201689728334856,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2254038572367516,-0.023714128901895615
|
| 365 |
+
363,3,45,1.7391554573659413,1.5618426011747903,0.177312856191151,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2039007765532208,-0.026587920362069806
|
| 366 |
+
364,4,45,1.7820564868757933,1.6066287088080249,0.17542777806776844,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2043542804827747,-0.028926502415006272
|
| 367 |
+
365,5,45,1.7665318676768078,1.5994122134604454,0.16711965421636243,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21247273546253398,-0.045353081246171545
|
| 368 |
+
366,6,45,1.8212679146159907,1.5750899608157503,0.24617795380024043,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2137121906779822,0.03246576312225824
|
| 369 |
+
367,7,45,1.815703031186651,1.5804272938212254,0.23527573736542573,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2081946448259575,0.02708109253946822
|
| 370 |
+
368,0,46,1.8194523601844181,1.6226502926734618,0.1968020675109563,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1868092171397855,0.009992850371170814
|
| 371 |
+
369,1,46,1.752191319535178,1.560189149519348,0.19200217001582986,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21478708601578322,-0.02278491599995336
|
| 372 |
+
370,2,46,1.7664689747661844,1.5716196851763282,0.19484928958985614,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.22446094833718844,-0.029611658747332292
|
| 373 |
+
371,3,46,1.7953138543802507,1.560837087259109,0.23447676712114163,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.199879851287182,0.03459691583395963
|
| 374 |
+
372,4,46,1.76528598502634,1.5822467571605412,0.18303922786579885,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20116882264320046,-0.018129594777401614
|
| 375 |
+
373,5,46,1.7619183093956603,1.5754228475354526,0.1864954618602077,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2203153424916282,-0.033819880631420496
|
| 376 |
+
374,6,46,1.803680225553937,1.554687687843026,0.248992537710911,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.2031599698404749,0.0458325678704361
|
| 377 |
+
375,7,46,1.8061093221331128,1.5576276636683704,0.24848165846474246,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21396089498618975,0.03452076347855271
|
| 378 |
+
376,0,47,1.8701222875409798,1.6698520873420155,0.20027020019896424,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.1848742174690654,0.015395982729898838
|
| 379 |
+
377,1,47,1.748306439557021,1.5567994344633687,0.19150700509365226,3,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20274917308432583,-0.011242167990673568
|
| 380 |
+
378,2,47,1.800781785004619,1.5719802933299059,0.2288014916747132,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23767655492330841,-0.008875063248595216
|
| 381 |
+
379,3,47,1.7895267601166815,1.5509970645013922,0.23852969561528936,2,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.19440575264370263,0.04412394297158673
|
| 382 |
+
380,4,47,1.7528003149292306,1.5628904893310898,0.18990982559814085,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.21181347814477758,-0.02190365254663673
|
| 383 |
+
381,5,47,1.7804719298301745,1.5830967299099008,0.19737519992027375,1,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.23613713532652958,-0.03876193540625583
|
| 384 |
+
382,6,47,1.8071958618088853,1.544342414257308,0.26285344755157736,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20157973652053762,0.061273711031039735
|
| 385 |
+
383,7,47,1.8072302977477013,1.5446686794175821,0.26256161833011915,0,model_based_controlled_zone_heterogeneity_conditional_on_randomized_design,0.20508212769039247,0.05747949063972668
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_recovery.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assignment_seed": 202574,
|
| 3 |
+
"bias": -0.01814289249999193,
|
| 4 |
+
"calibration_bins": 5,
|
| 5 |
+
"crossfit_group": "geographic_randomization_cluster",
|
| 6 |
+
"evidence_type": "semi_synthetic_hte_known_truth_recovery",
|
| 7 |
+
"fold_bias_sd": 0.015222342591006542,
|
| 8 |
+
"fold_mean_cate_sd": 0.022841410502041495,
|
| 9 |
+
"hte_beats_oracle_constant": false,
|
| 10 |
+
"interference": 0.0,
|
| 11 |
+
"known_truth_sd": 0.02466620646825247,
|
| 12 |
+
"oracle_constant_effect_rmse": 0.02466620646825247,
|
| 13 |
+
"persistence": 0.0,
|
| 14 |
+
"predicted_truth_correlation": 0.22877943542015464,
|
| 15 |
+
"predicted_truth_rank_correlation": 0.22388483006277077,
|
| 16 |
+
"recovery_gate": "rmse_below_oracle_constant_effect_rmse",
|
| 17 |
+
"rmse": 0.04172493041638294,
|
| 18 |
+
"rows": 384,
|
| 19 |
+
"simulation_seed": 202503,
|
| 20 |
+
"target_estimand": "controlled_zone_direct_effect"
|
| 21 |
+
}
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_subgroup_recovery.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
market_tightness_bin,mean_market_tightness,mean_predicted_cate,mean_known_truth,mean_error,rows
|
| 2 |
+
"(0.641, 0.831]",0.7667746281382558,0.21814639529426308,0.2333816831761034,-0.015235287881840288,96
|
| 3 |
+
"(0.831, 0.935]",0.8838535559400924,0.220469008781666,0.23601267435559584,-0.015543665573929834,96
|
| 4 |
+
"(0.935, 1.083]",1.0062254124357357,0.22606678427297666,0.23937431029486092,-0.013307526021884251,96
|
| 5 |
+
"(1.083, 1.685]",1.2265601443267178,0.19639042896685246,0.22487551948916584,-0.02848509052231335,96
|
CasualLab/artifacts/benchmarks/heterogeneity/hte_subgroups.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
modifier,modifier_bin,mean_estimated_cate,sd_estimated_cate,rows,evidence_type
|
| 2 |
+
market_tightness,"(0.641, 0.831]",0.21814639529426308,0.03178703918419193,96,model_based_conditional_contrast_summary
|
| 3 |
+
market_tightness,"(0.831, 0.935]",0.220469008781666,0.03798015201391059,96,model_based_conditional_contrast_summary
|
| 4 |
+
market_tightness,"(0.935, 1.083]",0.22606678427297666,0.030328608679469835,96,model_based_conditional_contrast_summary
|
| 5 |
+
market_tightness,"(1.083, 1.685]",0.19639042896685246,0.030607899058928176,96,model_based_conditional_contrast_summary
|
CasualLab/artifacts/benchmarks/heterogeneity/manifest.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"files": [
|
| 3 |
+
{
|
| 4 |
+
"bytes": 569,
|
| 5 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_calibration_by_score.csv",
|
| 6 |
+
"sha256": "08ac18f28bedef72493d419a4108216edfeeca5aae105d3893d115e63d51d99d"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"bytes": 3060,
|
| 10 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_calibration_chart.html",
|
| 11 |
+
"sha256": "def3ce7ed68018c092bcd820cafde3d7a404ed1ef0cfc4b182476e15d4bd306e"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"bytes": 419,
|
| 15 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_feature_importance.csv",
|
| 16 |
+
"sha256": "e69d0a036879db65762198f981e720fa251f48e02e6db1fd900f499c581c7fe1"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"bytes": 421,
|
| 20 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_fold_stability.csv",
|
| 21 |
+
"sha256": "66d286eeb98a8ebc284e0fad4081760846727d4f1524ab74bd2173c0ac97afa6"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"bytes": 70513,
|
| 25 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_predictions.csv",
|
| 26 |
+
"sha256": "cc7de1e8c63ace39fae0a8733d947b4d803bbe1aafa8285165f84965f9b34bea"
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"bytes": 773,
|
| 30 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_recovery.json",
|
| 31 |
+
"sha256": "15061cba7be0ab1d73d56a1ede13f8f2d8cbe871a8672ae6cfd7aa6b01f208f9"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"bytes": 496,
|
| 35 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_subgroup_recovery.csv",
|
| 36 |
+
"sha256": "f14fa83a0d1b7e93496c8d548fb9bd7d1932784e329d688649d5d3ba2eba1c25"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"bytes": 551,
|
| 40 |
+
"path": "artifacts/benchmarks/heterogeneity/hte_subgroups.csv",
|
| 41 |
+
"sha256": "b791840b87cdd157d5a0d23243af00781d30efa12b824eb939be54632e651bf8"
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"generated_at_utc": "2026-08-09T23:44:17.423382+00:00",
|
| 45 |
+
"metadata": {
|
| 46 |
+
"evidence_type": "semi_synthetic_hte_known_truth_recovery",
|
| 47 |
+
"simulation_config": {
|
| 48 |
+
"base_demand": 2.8677823154776916,
|
| 49 |
+
"base_fare": 22.475,
|
| 50 |
+
"base_supply": 2.222531294495211,
|
| 51 |
+
"base_wait_minutes": 5.0,
|
| 52 |
+
"budget": null,
|
| 53 |
+
"capacity_per_driver": 1.35,
|
| 54 |
+
"demand_noise_sd": 0.06,
|
| 55 |
+
"design": {
|
| 56 |
+
"budget": null,
|
| 57 |
+
"cluster_size": 2,
|
| 58 |
+
"n_clusters": 4,
|
| 59 |
+
"name": "geo_time",
|
| 60 |
+
"seed": 202574,
|
| 61 |
+
"treatment_duration": 4,
|
| 62 |
+
"treatment_probability": 0.5,
|
| 63 |
+
"treatment_saturation": 1.0,
|
| 64 |
+
"washout_periods": 0
|
| 65 |
+
},
|
| 66 |
+
"direct_demand_effect": 0.16,
|
| 67 |
+
"direct_supply_effect": 0.1,
|
| 68 |
+
"discount_rate": 0.1,
|
| 69 |
+
"driver_mobility": 0.0,
|
| 70 |
+
"incentive_per_driver": 1.5,
|
| 71 |
+
"individuals_per_cell": 100,
|
| 72 |
+
"matching_efficiency": 0.94,
|
| 73 |
+
"n_periods": 48,
|
| 74 |
+
"n_zones": 8,
|
| 75 |
+
"operating_cost_per_trip": 8.0,
|
| 76 |
+
"periods_per_day": 24,
|
| 77 |
+
"persistence": 0.0,
|
| 78 |
+
"reference_incentive_per_driver": 1.5,
|
| 79 |
+
"rider_substitution": 0.0,
|
| 80 |
+
"rider_value": 28.0,
|
| 81 |
+
"seed": 202503,
|
| 82 |
+
"spillover_strength": 0.0,
|
| 83 |
+
"supply_noise_sd": 0.05,
|
| 84 |
+
"time_pattern_strength": 0.22,
|
| 85 |
+
"treatment_version": "bundled",
|
| 86 |
+
"wait_disutility_per_minute": 0.25,
|
| 87 |
+
"zone_heterogeneity_sd": 0.12
|
| 88 |
+
},
|
| 89 |
+
"target_estimand": "controlled_zone_direct_effect"
|
| 90 |
+
}
|
| 91 |
+
}
|
CasualLab/artifacts/benchmarks/interference_manifest.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"files": [
|
| 3 |
+
{
|
| 4 |
+
"bytes": 79,
|
| 5 |
+
"path": "artifacts/benchmarks/interference_failures.csv",
|
| 6 |
+
"sha256": "f44a77beec92c70d65c6845e9a4cb971600cea81a7c376592c0a9c4b79cd5918"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"bytes": 869,
|
| 10 |
+
"path": "artifacts/benchmarks/interference_fit_ledger.csv",
|
| 11 |
+
"sha256": "764d868741cf5a3d7724e125fd6ababdc0784de7ea9517e67bc1e9fae0eaa017"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"bytes": 2019,
|
| 15 |
+
"path": "artifacts/benchmarks/interference_metadata.json",
|
| 16 |
+
"sha256": "852587e9de60fbe00241b0c881870d9adff1cd5c7a4006721cd2793c3fce5737"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"bytes": 84602,
|
| 20 |
+
"path": "artifacts/benchmarks/interference_records.csv",
|
| 21 |
+
"sha256": "106d8ee3a832aff89a2971ed761fe3c5a8b536849999927771e799373d24be1e"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"bytes": 2473,
|
| 25 |
+
"path": "artifacts/benchmarks/interference_summary.csv",
|
| 26 |
+
"sha256": "7b9e6e732867d507e8e2d3e169b4263046b90dc6eb228d7c3d5bf02e80d0641d"
|
| 27 |
+
}
|
| 28 |
+
],
|
| 29 |
+
"generated_at_utc": "2026-08-09T23:44:17.112219+00:00",
|
| 30 |
+
"metadata": {
|
| 31 |
+
"benchmark_config": {
|
| 32 |
+
"cluster_noise_sd": 0.04,
|
| 33 |
+
"confidence_level": 0.95,
|
| 34 |
+
"history_effect": 0.7,
|
| 35 |
+
"history_lags": 1,
|
| 36 |
+
"individuals_per_cell": 20,
|
| 37 |
+
"minimum_inference_clusters": 8,
|
| 38 |
+
"n_clusters": 32,
|
| 39 |
+
"n_periods": 32,
|
| 40 |
+
"n_zones": 32,
|
| 41 |
+
"neighbor_effect": 1.5,
|
| 42 |
+
"outcome_noise_sd": 0.08,
|
| 43 |
+
"own_effect": 2.0,
|
| 44 |
+
"replications": 24,
|
| 45 |
+
"saturation_levels": [
|
| 46 |
+
0.0,
|
| 47 |
+
0.3333333333333333,
|
| 48 |
+
0.6666666666666666,
|
| 49 |
+
1.0
|
| 50 |
+
],
|
| 51 |
+
"seed": 880321
|
| 52 |
+
},
|
| 53 |
+
"controlled_exposure_not_market_total": true,
|
| 54 |
+
"evidence_type": "semi_synthetic_exposure_mapped_known_truth_benchmark",
|
| 55 |
+
"known_estimands": {
|
| 56 |
+
"controlled_history_exposure_response": 0.7,
|
| 57 |
+
"controlled_zone_direct_effect": 2.0,
|
| 58 |
+
"full_horizon_persistent_effect": 0.678125,
|
| 59 |
+
"market_total_effect": 4.178125,
|
| 60 |
+
"spillover_effect": 1.5
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
CasualLab/artifacts/benchmarks/monte_carlo_records.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
CasualLab/artifacts/benchmarks/nyc_graph/failures.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
replication,assignment_seed,outcome_seed,estimator,target_estimand,stage,error
|
CasualLab/artifacts/benchmarks/nyc_graph/fit_ledger.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
estimator,target_estimand,identified,comparison_status,successful_fits,attempted_fits,failed_fits,fit_complete,target_inference_valid_rate,decision_eligible,recorded_failure_rows,evidence_type
|
| 2 |
+
nyc_graph_exposure_mapped_cluster_regression,controlled_history_exposure_response,True,identified_controlled_exposure_response,12,12,0,True,1.0,True,0,semi_synthetic_nyc_graph_fit_ledger
|
| 3 |
+
nyc_graph_exposure_mapped_cluster_regression,controlled_zone_direct_effect,True,identified_controlled_exposure_response,12,12,0,True,1.0,True,0,semi_synthetic_nyc_graph_fit_ledger
|
| 4 |
+
nyc_graph_exposure_mapped_cluster_regression,spillover_effect,True,identified_controlled_exposure_response,12,12,0,True,1.0,True,0,semi_synthetic_nyc_graph_fit_ledger
|
| 5 |
+
nyc_graph_naive_assignment_cluster_regression,market_total_effect,False,target_mismatch,12,12,0,True,0.0,False,0,semi_synthetic_nyc_graph_fit_ledger
|
CasualLab/artifacts/benchmarks/nyc_graph/manifest.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"artifact_directory": "artifacts/benchmarks/nyc_graph",
|
| 3 |
+
"artifact_type": "nyc_graph_interference_benchmark",
|
| 4 |
+
"bundle_valid": true,
|
| 5 |
+
"causal_claim": false,
|
| 6 |
+
"causal_claim_from_nyc_data": false,
|
| 7 |
+
"evidence_type": "semi_synthetic_known_truth_on_descriptive_nyc_graph",
|
| 8 |
+
"files": [
|
| 9 |
+
{
|
| 10 |
+
"bytes": 47427,
|
| 11 |
+
"evidence_types": [
|
| 12 |
+
"semi_synthetic_known_truth_on_descriptive_nyc_graph",
|
| 13 |
+
"semi_synthetic_nyc_graph_target_mismatch_diagnostic"
|
| 14 |
+
],
|
| 15 |
+
"media_type": "text/csv",
|
| 16 |
+
"path": "records.csv",
|
| 17 |
+
"role": "records",
|
| 18 |
+
"rows": 48,
|
| 19 |
+
"sha256": "a624cb031e69e5102ffff4cb5229a2d061cc9b5be70d1d6bcd20970a3016e1a5"
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"bytes": 2687,
|
| 23 |
+
"evidence_types": [
|
| 24 |
+
"semi_synthetic_nyc_graph_known_truth_monte_carlo",
|
| 25 |
+
"semi_synthetic_nyc_graph_target_mismatch_diagnostic"
|
| 26 |
+
],
|
| 27 |
+
"media_type": "text/csv",
|
| 28 |
+
"path": "summary.csv",
|
| 29 |
+
"role": "summary",
|
| 30 |
+
"rows": 4,
|
| 31 |
+
"sha256": "837e3a4f483afd54ce252930f8738e4480699a58281e8b753d019b471ccb54f0"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"bytes": 876,
|
| 35 |
+
"evidence_types": [
|
| 36 |
+
"semi_synthetic_nyc_graph_fit_ledger"
|
| 37 |
+
],
|
| 38 |
+
"media_type": "text/csv",
|
| 39 |
+
"path": "fit_ledger.csv",
|
| 40 |
+
"role": "fit_ledger",
|
| 41 |
+
"rows": 4,
|
| 42 |
+
"sha256": "0a75f1e7bbc5c553cc1ee3e8bcb8d549515e10f459f03b1b9dffa12cb5d41b2d"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"bytes": 79,
|
| 46 |
+
"evidence_types": [
|
| 47 |
+
"semi_synthetic_known_truth_on_descriptive_nyc_graph"
|
| 48 |
+
],
|
| 49 |
+
"media_type": "text/csv",
|
| 50 |
+
"path": "failures.csv",
|
| 51 |
+
"role": "failures",
|
| 52 |
+
"rows": 0,
|
| 53 |
+
"sha256": "f44a77beec92c70d65c6845e9a4cb971600cea81a7c376592c0a9c4b79cd5918"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"bytes": 8568,
|
| 57 |
+
"evidence_types": [
|
| 58 |
+
"semi_synthetic_known_truth_on_descriptive_nyc_graph"
|
| 59 |
+
],
|
| 60 |
+
"media_type": "application/json",
|
| 61 |
+
"path": "metadata.json",
|
| 62 |
+
"role": "metadata",
|
| 63 |
+
"sha256": "f8fb5b089938b90b454168e49ceab643edf1334d6ce5f7e507fb392d22bfb944"
|
| 64 |
+
}
|
| 65 |
+
],
|
| 66 |
+
"input_graph_evidence_label": "descriptive_real_data",
|
| 67 |
+
"inputs": [
|
| 68 |
+
{
|
| 69 |
+
"bytes": 3166,
|
| 70 |
+
"evidence_types": [
|
| 71 |
+
"descriptive_real_data"
|
| 72 |
+
],
|
| 73 |
+
"media_type": "application/json",
|
| 74 |
+
"path": "artifacts/nyc_full/calibration_network/manifest.json",
|
| 75 |
+
"role": "calibration_manifest",
|
| 76 |
+
"sha256": "fa68be2b5f54171c32163a8290e1587d8606ee9cfde66026be6ed7ac2b06b87d"
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"bytes": 10782094,
|
| 80 |
+
"evidence_types": [
|
| 81 |
+
"descriptive_real_data"
|
| 82 |
+
],
|
| 83 |
+
"media_type": "text/csv",
|
| 84 |
+
"path": "artifacts/nyc_full/calibration_network/exposure_mapping_edges.csv",
|
| 85 |
+
"role": "exposure_mapping",
|
| 86 |
+
"sha256": "bc03f6af8d495d78e16325f5169537e669e112068358adfbf8eb0b12c33def60"
|
| 87 |
+
}
|
| 88 |
+
],
|
| 89 |
+
"metadata_file": "metadata.json",
|
| 90 |
+
"portable_paths": true,
|
| 91 |
+
"schema_version": "1.0.0"
|
| 92 |
+
}
|
CasualLab/artifacts/benchmarks/nyc_graph/metadata.json
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"artifact_bundle": {
|
| 3 |
+
"artifact_type": "nyc_graph_interference_benchmark",
|
| 4 |
+
"bundle_valid": true,
|
| 5 |
+
"causal_claim": false,
|
| 6 |
+
"causal_claim_from_nyc_data": false,
|
| 7 |
+
"evidence_type": "semi_synthetic_known_truth_on_descriptive_nyc_graph",
|
| 8 |
+
"input_graph_evidence_label": "descriptive_real_data",
|
| 9 |
+
"inputs": [
|
| 10 |
+
{
|
| 11 |
+
"bytes": 3166,
|
| 12 |
+
"evidence_types": [
|
| 13 |
+
"descriptive_real_data"
|
| 14 |
+
],
|
| 15 |
+
"media_type": "application/json",
|
| 16 |
+
"path": "artifacts/nyc_full/calibration_network/manifest.json",
|
| 17 |
+
"role": "calibration_manifest",
|
| 18 |
+
"sha256": "fa68be2b5f54171c32163a8290e1587d8606ee9cfde66026be6ed7ac2b06b87d"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"bytes": 10782094,
|
| 22 |
+
"evidence_types": [
|
| 23 |
+
"descriptive_real_data"
|
| 24 |
+
],
|
| 25 |
+
"media_type": "text/csv",
|
| 26 |
+
"path": "artifacts/nyc_full/calibration_network/exposure_mapping_edges.csv",
|
| 27 |
+
"role": "exposure_mapping",
|
| 28 |
+
"sha256": "bc03f6af8d495d78e16325f5169537e669e112068358adfbf8eb0b12c33def60"
|
| 29 |
+
}
|
| 30 |
+
],
|
| 31 |
+
"portable_output_directory": "artifacts/benchmarks/nyc_graph",
|
| 32 |
+
"portable_paths": true,
|
| 33 |
+
"schema_version": "1.0.0",
|
| 34 |
+
"tables": {
|
| 35 |
+
"failures": {
|
| 36 |
+
"path": "failures.csv",
|
| 37 |
+
"rows": 0
|
| 38 |
+
},
|
| 39 |
+
"fit_ledger": {
|
| 40 |
+
"path": "fit_ledger.csv",
|
| 41 |
+
"rows": 4
|
| 42 |
+
},
|
| 43 |
+
"records": {
|
| 44 |
+
"path": "records.csv",
|
| 45 |
+
"rows": 48
|
| 46 |
+
},
|
| 47 |
+
"summary": {
|
| 48 |
+
"path": "summary.csv",
|
| 49 |
+
"rows": 4
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"assignment_design": "one randomized geographic cluster per selected zone; balanced saturation arms followed by within-zone-period binomial opportunity assignment",
|
| 54 |
+
"calibration_bundle": {
|
| 55 |
+
"directory_name": "artifacts/nyc_full/calibration_network",
|
| 56 |
+
"exposure_mapping_sha256": "bc03f6af8d495d78e16325f5169537e669e112068358adfbf8eb0b12c33def60",
|
| 57 |
+
"manifest_sha256": "fa68be2b5f54171c32163a8290e1587d8606ee9cfde66026be6ed7ac2b06b87d",
|
| 58 |
+
"manifest_source_data_attestation": {
|
| 59 |
+
"all_valid": true,
|
| 60 |
+
"declared_file_set_sha256": "eefdc0eb1c93cf20c0c207b587b0fe182e80a7bb52f4a8d65beedbbb18a56593",
|
| 61 |
+
"entries": 201,
|
| 62 |
+
"hashes_recomputed": true,
|
| 63 |
+
"mismatches": [],
|
| 64 |
+
"path": "data/nyc_full/manifest.json",
|
| 65 |
+
"queried_files_listed": true,
|
| 66 |
+
"scope_is_full_nyc_descriptive": true,
|
| 67 |
+
"sha256": "e2c7cefab0f1a5c66dea34fe3300c73c9fa7f459b75a96601d95a1b0ec8d38bb"
|
| 68 |
+
},
|
| 69 |
+
"verified_file_sha256": {
|
| 70 |
+
"calibration.json": "544fe790a00fe40ba41e0f83f2b6f4b233b563eac9d43c22267b89f90774145d",
|
| 71 |
+
"exposure_mapping_edges.csv": "bc03f6af8d495d78e16325f5169537e669e112068358adfbf8eb0b12c33def60",
|
| 72 |
+
"hour_of_day_profile.csv": "95557c8811073da554f719586f6325160ee89bf016b634576944283014b9534a",
|
| 73 |
+
"od_weighted_edges.csv": "abe64f555ca64c6b3a2fce5ebb3277fc075beaa7124aefc1efab0bc345a6dc81",
|
| 74 |
+
"temporal_autocorrelation.csv": "9047474ce36de05611802e244a825a8d4789c5f11d1c1b6b5ee483dc2082f9d4",
|
| 75 |
+
"zone_graph_nodes.csv": "1c06ffea328b9fdcd9199049fba112b0b1e235514848f2cc7af81c60d9bf90ed",
|
| 76 |
+
"zone_temporal_profile.csv": "622013263ba120b692329c7ecaf1c1c96fb318c3fb5a283002425ec8c096c823"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"causal_claim_from_nyc_data": false,
|
| 80 |
+
"config": {
|
| 81 |
+
"cluster_noise_sd": 0.04,
|
| 82 |
+
"confidence_level": 0.95,
|
| 83 |
+
"history_effect": 0.7,
|
| 84 |
+
"history_lags": 1,
|
| 85 |
+
"individuals_per_cell": 20,
|
| 86 |
+
"minimum_inference_clusters": 8,
|
| 87 |
+
"n_periods": 24,
|
| 88 |
+
"n_zones": 16,
|
| 89 |
+
"neighbor_effect": 1.5,
|
| 90 |
+
"outcome_noise_sd": 0.06,
|
| 91 |
+
"own_effect": 2.0,
|
| 92 |
+
"replications": 12,
|
| 93 |
+
"saturation_levels": [
|
| 94 |
+
0.0,
|
| 95 |
+
0.3333333333333333,
|
| 96 |
+
0.6666666666666666,
|
| 97 |
+
1.0
|
| 98 |
+
],
|
| 99 |
+
"seed": 912731
|
| 100 |
+
},
|
| 101 |
+
"estimand_definitions": {
|
| 102 |
+
"controlled_history_exposure_response": "Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.",
|
| 103 |
+
"controlled_zone_direct_effect": "Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.",
|
| 104 |
+
"market_total_effect": "Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.",
|
| 105 |
+
"spillover_effect": "Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights."
|
| 106 |
+
},
|
| 107 |
+
"evidence_type": "semi_synthetic_known_truth_on_descriptive_nyc_graph",
|
| 108 |
+
"graph_weight_role": "Completed-trip OD weights define relative neighbor exposure geometry only. They are row-normalized and are not spillover strength, a causal effect, substitution, mobility, or equilibrium response.",
|
| 109 |
+
"history_mapping": "mean of 1 exact own-treatment lag(s)",
|
| 110 |
+
"input_graph_evidence_label": "descriptive_real_data",
|
| 111 |
+
"known_estimands": {
|
| 112 |
+
"controlled_history_exposure_response": 0.7,
|
| 113 |
+
"controlled_zone_direct_effect": 2.0,
|
| 114 |
+
"full_horizon_history_contribution": 0.6708333333333333,
|
| 115 |
+
"market_total_effect": 4.170833333333333,
|
| 116 |
+
"spillover_effect": 1.5
|
| 117 |
+
},
|
| 118 |
+
"market_total_bridge": "Known only because the benchmark declares an additive DGP. Controlled exposure slopes remain separate from market_total_effect.",
|
| 119 |
+
"naive_assignment_status": "target mismatch; cluster-aware coefficient uncertainty does not justify market-total bias, RMSE, coverage, or power",
|
| 120 |
+
"zone_subset": {
|
| 121 |
+
"selected_directed_density": 1.0,
|
| 122 |
+
"selected_directed_edges": 240,
|
| 123 |
+
"selected_zone_count": 16,
|
| 124 |
+
"selected_zone_ids_in_order": [
|
| 125 |
+
"265",
|
| 126 |
+
"132",
|
| 127 |
+
"138",
|
| 128 |
+
"230",
|
| 129 |
+
"164",
|
| 130 |
+
"161",
|
| 131 |
+
"68",
|
| 132 |
+
"246",
|
| 133 |
+
"48",
|
| 134 |
+
"234",
|
| 135 |
+
"170",
|
| 136 |
+
"79",
|
| 137 |
+
"249",
|
| 138 |
+
"231",
|
| 139 |
+
"163",
|
| 140 |
+
"186"
|
| 141 |
+
],
|
| 142 |
+
"selection_rule": "Within a connected component large enough for the requested sample, start at the zone with greatest raw OD weighted degree, then greedily add the zone with greatest raw OD weight to already selected zones; break ties by full-graph weighted degree, neighbor count, and lexical zone ID. Only pre-treatment graph fields are used.",
|
| 143 |
+
"selection_scores": [
|
| 144 |
+
{
|
| 145 |
+
"full_graph_neighbor_count": 257,
|
| 146 |
+
"full_graph_raw_weighted_degree": 741434.0,
|
| 147 |
+
"zone_id": "265"
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"full_graph_neighbor_count": 259,
|
| 151 |
+
"full_graph_raw_weighted_degree": 724527.0,
|
| 152 |
+
"zone_id": "132"
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"full_graph_neighbor_count": 256,
|
| 156 |
+
"full_graph_raw_weighted_degree": 701385.0,
|
| 157 |
+
"zone_id": "138"
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"full_graph_neighbor_count": 254,
|
| 161 |
+
"full_graph_raw_weighted_degree": 446526.0,
|
| 162 |
+
"zone_id": "230"
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"full_graph_neighbor_count": 256,
|
| 166 |
+
"full_graph_raw_weighted_degree": 379510.0,
|
| 167 |
+
"zone_id": "164"
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"full_graph_neighbor_count": 256,
|
| 171 |
+
"full_graph_raw_weighted_degree": 450306.0,
|
| 172 |
+
"zone_id": "161"
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"full_graph_neighbor_count": 257,
|
| 176 |
+
"full_graph_raw_weighted_degree": 423294.0,
|
| 177 |
+
"zone_id": "68"
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"full_graph_neighbor_count": 257,
|
| 181 |
+
"full_graph_raw_weighted_degree": 425199.0,
|
| 182 |
+
"zone_id": "246"
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"full_graph_neighbor_count": 255,
|
| 186 |
+
"full_graph_raw_weighted_degree": 349954.0,
|
| 187 |
+
"zone_id": "48"
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"full_graph_neighbor_count": 256,
|
| 191 |
+
"full_graph_raw_weighted_degree": 404787.0,
|
| 192 |
+
"zone_id": "234"
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"full_graph_neighbor_count": 255,
|
| 196 |
+
"full_graph_raw_weighted_degree": 366722.0,
|
| 197 |
+
"zone_id": "170"
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"full_graph_neighbor_count": 255,
|
| 201 |
+
"full_graph_raw_weighted_degree": 485369.0,
|
| 202 |
+
"zone_id": "79"
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"full_graph_neighbor_count": 256,
|
| 206 |
+
"full_graph_raw_weighted_degree": 363665.0,
|
| 207 |
+
"zone_id": "249"
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"full_graph_neighbor_count": 257,
|
| 211 |
+
"full_graph_raw_weighted_degree": 410838.0,
|
| 212 |
+
"zone_id": "231"
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"full_graph_neighbor_count": 254,
|
| 216 |
+
"full_graph_raw_weighted_degree": 307784.0,
|
| 217 |
+
"zone_id": "163"
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"full_graph_neighbor_count": 257,
|
| 221 |
+
"full_graph_raw_weighted_degree": 289138.0,
|
| 222 |
+
"zone_id": "186"
|
| 223 |
+
}
|
| 224 |
+
],
|
| 225 |
+
"selection_uses_only_pre_treatment_graph_fields": true,
|
| 226 |
+
"subset_raw_mapping_sha256": "0948c4b37a6dc21d5b9e05accf92f456cf11b0b125833117da5741031b37f935",
|
| 227 |
+
"subset_weight_handling": "Raw completed-trip weights are restricted to the selected induced graph and row-normalized by add_mapped_exposures."
|
| 228 |
+
}
|
| 229 |
+
}
|
CasualLab/artifacts/benchmarks/nyc_graph/records.csv
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
method,exposure_term,target_estimand,estimate,standard_error,ci_low,ci_high,p_value,n_obs,n_clusters,degrees_freedom,inference_valid,minimum_inference_clusters,variance_estimator,effect_scale,identification_scope,evidence_type,mapping_ids,covariates,r_squared,design,estimator,replication,seed,assignment_seed,outcome_seed,std_error,truth,market_total_truth,estimation_error,diagnostic_gap_to_market_total,identified,comparison_status,inference_valid_for_target,coefficient_inference_cluster_aware,controlled_exposure_not_market_total,graph_weight_is_spillover_strength,fit_status,design_cost,input_graph_evidence_label,estimand_definition,coefficient_estimand
|
| 2 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.7083315928925008,0.0400289399053851,0.6230119271219281,0.7936512586630735,1.844773620583876e-11,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9950451717204716,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,0,2928165100,2928165100,4017242078,0.0400289399053851,0.7,4.170833333333333,0.00833159289250085,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 3 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0249235986406626,0.036590533865344804,1.946932721861584,2.1029144754197415,9.263366787800106e-19,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9950451717204716,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,0,2928165100,2928165100,4017242078,0.036590533865344804,2.0,4.170833333333333,0.024923598640662625,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 4 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,2.112136607299253,0.1339940250474187,1.8265351035042072,2.397738111094299,9.617587688228951e-11,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9950451717204716,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,0,2928165100,2928165100,4017242078,0.1339940250474187,1.5,4.170833333333333,0.6121366072992531,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 5 |
+
cluster_robust,cluster_saturation,market_total_effect,2.624307790462022,0.07579584032274331,2.4627527810507894,2.7858627998732546,9.969706622712613e-16,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,0,2928165100,2928165100,4017242078,0.07579584032274331,4.170833333333333,4.170833333333333,,-1.5465255428713114,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 6 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.7212482904518608,0.0485821636521198,0.6176978598132393,0.8247987210904822,2.2456443134870714e-10,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9934577189263759,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,1,1048804821,1048804821,3706351384,0.0485821636521198,0.7,4.170833333333333,0.02124829045186083,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 7 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0512483072039664,0.040167597054248695,1.9656331007164598,2.136863513691473,3.0734598025571197e-18,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9934577189263759,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,1,1048804821,1048804821,3706351384,0.040167597054248695,2.0,4.170833333333333,0.05124830720396645,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 8 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.684993181447581,0.1526241052603879,1.3596826016488597,2.010303761246302,1.3390159558071665e-08,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9934577189263759,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,1,1048804821,1048804821,3706351384,0.1526241052603879,1.5,4.170833333333333,0.18499318144758092,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 9 |
+
cluster_robust,cluster_saturation,market_total_effect,2.5856224625643103,0.0938447228752751,2.385597170638622,2.7856477544899985,2.917619405619937e-14,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,1,1048804821,1048804821,3706351384,0.0938447228752751,4.170833333333333,4.170833333333333,,-1.5852108707690231,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 10 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.6724494756708175,0.03228292035823307,0.6036400597439192,0.7412588915977157,1.7492044866394416e-12,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9942841996063361,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,2,3893930631,3893930631,3031793670,0.03228292035823307,0.7,4.170833333333333,-0.02755052432918248,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 11 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0028151133928036,0.028947913362132763,1.941114096612182,2.064516130173425,3.291550754756524e-20,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9942841996063361,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,2,3893930631,3893930631,3031793670,0.028947913362132763,2.0,4.170833333333333,0.002815113392803603,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 12 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.1958656545477222,0.1851878097029838,0.8011471817130871,1.5905841273823573,1.0798861174407573e-05,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9942841996063361,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,2,3893930631,3893930631,3031793670,0.1851878097029838,1.5,4.170833333333333,-0.3041343454522778,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 13 |
+
cluster_robust,cluster_saturation,market_total_effect,2.4984046583448936,0.03955159441856659,2.414102430395275,2.582706886294512,1.2833983361117407e-19,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,2,3893930631,3893930631,3031793670,0.03955159441856659,4.170833333333333,4.170833333333333,,-1.6724286749884398,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 14 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.621410600734279,0.027811266506250036,0.5621322893780906,0.6806889120904674,6.298236049041131e-13,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9952593912050383,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,3,3552901275,3552901275,2789188732,0.027811266506250036,0.7,4.170833333333333,-0.07858939926572095,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 15 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0585710381759457,0.019710048404632554,2.0165600644609305,2.100582011890961,6.917685389653315e-23,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9952593912050383,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,3,3552901275,3552901275,2789188732,0.019710048404632554,2.0,4.170833333333333,0.05857103817594567,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 16 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.367932384568104,0.2164157179730502,0.9066532008424535,1.8292115682937544,1.372316729788677e-05,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9952593912050383,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,3,3552901275,3552901275,2789188732,0.2164157179730502,1.5,4.170833333333333,-0.13206761543189605,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 17 |
+
cluster_robust,cluster_saturation,market_total_effect,2.55244662761966,0.04715592428777515,2.4519361542260305,2.6529571010132895,1.2893904045596529e-18,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,3,3552901275,3552901275,2789188732,0.04715592428777515,4.170833333333333,4.170833333333333,,-1.6183867057136734,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 18 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.7286718335926566,0.02963322117963084,0.6655101177758601,0.7918335494094532,1.552104707139828e-13,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9965287226131679,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,4,3857458645,3857458645,2829396905,0.02963322117963084,0.7,4.170833333333333,0.02867183359265668,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 19 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,1.971760180012295,0.029797870891949664,1.908247521641,2.03527283838359,6.40957130778924e-20,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9965287226131679,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,4,3857458645,3857458645,2829396905,0.029797870891949664,2.0,4.170833333333333,-0.028239819987704973,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 20 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.7120773135840448,0.13474618683694334,1.4248726148845292,1.9992820122835604,1.9715010863529232e-09,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9965287226131679,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,4,3857458645,3857458645,2829396905,0.13474618683694334,1.5,4.170833333333333,0.2120773135840448,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 21 |
+
cluster_robust,cluster_saturation,market_total_effect,2.545396810948712,0.032982809638668495,2.4750956163330873,2.6156980055643366,6.4212107807469024e-21,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,4,3857458645,3857458645,2829396905,0.032982809638668495,4.170833333333333,4.170833333333333,,-1.6254365223846214,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 22 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.6964204483658009,0.027902618497863366,0.6369474248486022,0.7558934718829995,1.2473842224555877e-13,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9964533820741062,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,5,940105500,940105500,1211719354,0.027902618497863366,0.7,4.170833333333333,-0.0035795516341990963,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 23 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0109082704281103,0.02518324280763015,1.9572314589900655,2.064585081866155,3.854192680174363e-21,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9964533820741062,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,5,940105500,940105500,1211719354,0.02518324280763015,2.0,4.170833333333333,0.010908270428110267,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 24 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.4921617253584256,0.07476552785812549,1.3328027749816873,1.651520675735164,3.253045993747203e-12,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9964533820741062,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,5,940105500,940105500,1211719354,0.07476552785812549,1.5,4.170833333333333,-0.007838274641574383,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 25 |
+
cluster_robust,cluster_saturation,market_total_effect,2.622115693350807,0.07580146856575722,2.46054868762356,2.783682699078054,1.0105106102741505e-15,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,5,940105500,940105500,1211719354,0.07580146856575722,4.170833333333333,4.170833333333333,,-1.5487176399825264,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 26 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.7058762275602932,0.025827340444279912,0.6508265545073152,0.7609259006132713,3.2859239068731055e-14,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9961669905240094,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,6,2329195509,2329195509,2325481028,0.025827340444279912,0.7,4.170833333333333,0.005876227560293268,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 27 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0173366330576643,0.031179952753856394,1.9508781369298818,2.0837951291854466,8.970911997496976e-20,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9961669905240094,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,6,2329195509,2329195509,2325481028,0.031179952753856394,2.0,4.170833333333333,0.017336633057664308,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 28 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.6769475008696249,0.1544930374272336,1.3476533864531983,2.0062416152860516,1.6814245668061205e-08,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9961669905240094,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,6,2329195509,2329195509,2325481028,0.1544930374272336,1.5,4.170833333333333,0.17694750086962485,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 29 |
+
cluster_robust,cluster_saturation,market_total_effect,2.5832222309280617,0.05405626766228821,2.4680040237846197,2.6984404380715037,8.270648308788105e-18,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,6,2329195509,2329195509,2325481028,0.05405626766228821,4.170833333333333,4.170833333333333,,-1.5876111024052717,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 30 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.6614815049655682,0.03819363000970557,0.5800737096381031,0.7428893002930334,2.5108880068935824e-11,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9973734707384297,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,7,655649537,655649537,990770808,0.03819363000970557,0.7,4.170833333333333,-0.03851849503443172,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 31 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0000314605729734,0.029376119104690852,1.9374177448569703,2.0626451762889766,4.186060696534263e-20,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9973734707384297,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,7,655649537,655649537,990770808,0.029376119104690852,2.0,4.170833333333333,3.1460572973429635e-05,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 32 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.690230219331459,0.17610904174974945,1.3148626823249878,2.06559775633793,8.553922018250877e-08,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9973734707384297,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,7,655649537,655649537,990770808,0.17610904174974945,1.5,4.170833333333333,0.1902302193314589,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 33 |
+
cluster_robust,cluster_saturation,market_total_effect,2.5782492404405257,0.04184113761617333,2.489066966682829,2.6674315141982223,1.8596785315149907e-19,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,7,655649537,655649537,990770808,0.04184113761617333,4.170833333333333,4.170833333333333,,-1.5925840928928077,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 34 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.710287842939129,0.029370498080921313,0.647686108151685,0.7728895777265731,1.9808881791019632e-13,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9948710923205454,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,8,2491347616,2491347616,3207477072,0.029370498080921313,0.7,4.170833333333333,0.0102878429391291,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 35 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,1.979361860328981,0.0309315651234973,1.91343278990305,2.045290930754912,1.0575168686714849e-19,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9948710923205454,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,8,2491347616,2491347616,3207477072,0.0309315651234973,2.0,4.170833333333333,-0.020638139671018907,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 36 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.4504781573672725,0.1635802040846092,1.1018152057085568,1.7991411090259881,2.3717125956861434e-07,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9948710923205454,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,8,2491347616,2491347616,3207477072,0.1635802040846092,1.5,4.170833333333333,-0.04952184263272752,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 37 |
+
cluster_robust,cluster_saturation,market_total_effect,2.572518804622825,0.036756617742301205,2.4941739284396824,2.6508636808059673,2.77094063462149e-20,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,8,2491347616,2491347616,3207477072,0.036756617742301205,4.170833333333333,4.170833333333333,,-1.5983145287105085,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 38 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.6813597554188382,0.043335152499095586,0.5889930643178773,0.773726446519799,9.969779773860225e-11,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9940419846850866,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,9,3579594447,3579594447,1675792621,0.043335152499095586,0.7,4.170833333333333,-0.018640244581161758,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 39 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.014773772139475,0.03823713650504586,1.9332732449122878,2.096274299366662,1.9262553490605412e-18,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9940419846850866,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,9,3579594447,3579594447,1675792621,0.03823713650504586,2.0,4.170833333333333,0.01477377213947495,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 40 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.4225643002916586,0.2207518178535052,0.9520429384463105,1.8930856621370067,1.1054301975798596e-05,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9940419846850866,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,9,3579594447,3579594447,1675792621,0.2207518178535052,1.5,4.170833333333333,-0.07743569970834141,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 41 |
+
cluster_robust,cluster_saturation,market_total_effect,2.475554471551048,0.04510710788357637,2.3794109469510833,2.5716979961510122,1.0488275456733801e-18,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,9,3579594447,3579594447,1675792621,0.04510710788357637,4.170833333333333,4.170833333333333,,-1.6952788617822856,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 42 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.6757752604376275,0.048304890724079425,0.5728158230554737,0.7787346978197812,5.172957788107401e-10,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9946618071911595,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,10,1620274796,1620274796,2401059440,0.048304890724079425,0.7,4.170833333333333,-0.024224739562372477,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 43 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,2.0229776441458123,0.04234027078962447,1.9327314932123894,2.1132237950792354,8.292896729367578e-18,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9946618071911595,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,10,1620274796,1620274796,2401059440,0.04234027078962447,2.0,4.170833333333333,0.02297764414581227,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 44 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.4571276200693042,0.15663437631165045,1.123269349860798,1.7909858902778104,1.2820874188049342e-07,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9946618071911595,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,10,1620274796,1620274796,2401059440,0.15663437631165045,1.5,4.170833333333333,-0.042872379930695814,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 45 |
+
cluster_robust,cluster_saturation,market_total_effect,2.6008033822999623,0.05396837157331081,2.485772521235428,2.7158342433644966,7.296017152301953e-18,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,10,1620274796,1620274796,2401059440,0.05396837157331081,4.170833333333333,4.170833333333333,,-1.570029951033371,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
| 46 |
+
exposure_mapped_cluster_regression,history_exposure,controlled_history_exposure_response,0.7217393830543719,0.024484854764757313,0.6695511504929328,0.773927615615811,1.0780254261044905e-14,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9952569694587319,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,11,472196254,472196254,2495315618,0.024484854764757313,0.7,4.170833333333333,0.021739383054371952,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit response to exact-lag own-treatment history holding current own and NYC-graph neighbor exposure fixed.,
|
| 47 |
+
exposure_mapped_cluster_regression,treatment,controlled_zone_direct_effect,1.9717325337361218,0.028843626759448165,1.9102537985874002,2.0332112688848434,3.9404808862687076e-20,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9952569694587319,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,11,472196254,472196254,2495315618,0.028843626759448165,2.0,4.170833333333333,-0.028267466263878216,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,Per-unit own-treatment response holding NYC-graph neighbor exposure and lagged own exposure fixed.,
|
| 48 |
+
exposure_mapped_cluster_regression,neighbor_exposure,spillover_effect,1.2440566674014217,0.1161334103993276,0.9965241625814679,1.4915891722213754,2.006062120196581e-08,368,16,15.0,True,8.0,CR1 cluster-t,per-unit exposure slope; not the full-policy market total,"conditional on randomized support, a correct pre-treatment exposure map, and no unmapped interference or omitted exposure history",semi_synthetic_known_truth_on_descriptive_nyc_graph,['4ab5bc1bad54cab00ddac7c618d97477ea6f41b6a79fa0788484dc5f4e92b50f'],"['graph_baseline_score', 'period_sin', 'period_cos']",0.9952569694587319,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,11,472196254,472196254,2495315618,0.1161334103993276,1.5,4.170833333333333,-0.25594333259857827,,True,identified_controlled_exposure_response,True,True,True,False,ok,384.0,descriptive_real_data,"Per-unit response to row-normalized NYC OD-neighbor exposure holding own and lagged exposure fixed; the coefficient is declared by the DGP, not learned from OD weights.",
|
| 49 |
+
cluster_robust,cluster_saturation,market_total_effect,2.5533404407018363,0.04871217514122153,2.4495128971338516,2.657167984269821,2.0825078826789316e-18,384,16,,True,,,stage-one saturation coefficient; not full-policy market total,Randomization identifies an assignment-saturation contrast. Omitted NYC-graph neighbor exposure and history prevent relabeling it market_total_effect.,semi_synthetic_nyc_graph_target_mismatch_diagnostic,,,,two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,11,472196254,472196254,2495315618,0.04871217514122153,4.170833333333333,4.170833333333333,,-1.617492892631497,False,target_mismatch,False,True,False,False,ok,384.0,descriptive_real_data,Full-horizon all-selected-zone treatment versus all-zero under the declared additive DGP and startup-history convention.,stage_one_saturation_assignment_slope
|
CasualLab/artifacts/benchmarks/nyc_graph/summary.csv
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
design,estimator,target_estimand,truth,mean_estimate,bias,bias_mcse,variance,rmse,rmse_mcse,coverage,coverage_mcse,power,power_mcse,binomial_mcse_method,mean_std_error,replications,mean_design_cost,information_cost,confidence_level,evidence_type,identified,comparison_status,market_total_truth,controlled_exposure_not_market_total,graph_weight_is_spillover_strength,diagnostic_mean_gap_to_market_total,diagnostic_gap_mcse,inference_valid_for_target,withheld_reason,fit_complete,successful_fits,failed_fits,decision_eligible
|
| 2 |
+
two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,controlled_history_exposure_response,0.7000000000000001,0.6920876846736453,-0.00791231532635465,0.008948845576254083,0.0009609820457717072,0.03071652555950512,0.007992992298409503,0.9166666666666666,0.08538610037318711,1.0,0.051396392675466224,jeffreys_posterior_standard_deviation,0.034646458051860105,12,384.0,0.3623058978999289,0.95,semi_synthetic_nyc_graph_known_truth_monte_carlo,True,identified_controlled_exposure_response,4.170833333333333,True,False,,,True,,True,12,0,True
|
| 3 |
+
two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,controlled_zone_direct_effect,2.0,2.0105367009862345,0.01053670098623429,0.008044411710232057,0.0007765507171646237,0.02868554034830468,0.005430829900390073,0.9166666666666666,0.08538610037318711,1.0,0.051396392675466224,jeffreys_posterior_standard_deviation,0.031775489785175144,12,384.0,0.3159783264284988,0.95,semi_synthetic_nyc_graph_known_truth_monte_carlo,True,identified_controlled_exposure_response,4.170833333333333,True,False,,,True,,True,12,0,True
|
| 4 |
+
two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_exposure_mapped_cluster_regression,spillover_effect,1.5,1.5422142776779892,0.04221427767798928,0.07208048039244419,0.06234714784326636,0.2427624300206587,0.06142652779010314,0.8333333333333334,0.10533126105868579,1.0,0.051396392675466224,jeffreys_posterior_standard_deviation,0.15711960504208208,12,384.0,22.63050141294152,0.95,semi_synthetic_nyc_graph_known_truth_monte_carlo,True,identified_controlled_exposure_response,4.170833333333333,True,False,,,True,,True,12,0,True
|
| 5 |
+
two_stage_saturation_on_fixed_nyc_od_graph,nyc_graph_naive_assignment_cluster_regression,market_total_effect,4.170833333333333,2.5659985511528887,,,0.0020138366742643373,,,,,,,,0.053797836477304774,12,384.0,,0.95,semi_synthetic_nyc_graph_target_mismatch_diagnostic,False,target_mismatch,4.170833333333333,False,False,-1.6048347821804445,0.012954525188341,False,"The assignment coefficient omits mapped NYC-graph neighbor and history exposure; market-total bias, RMSE, coverage, and power are withheld.",True,12,0,False
|