archeo 2.0.0.dev6__tar.gz → 2.0.0.dev7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/PKG-INFO +1 -1
- archeo-2.0.0.dev7/archeo/constants/bayesian.py +3 -0
- archeo-2.0.0.dev7/archeo/constants/physics.py +58 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/visualization/base.py +2 -2
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/visualization/estimation.py +2 -2
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo.egg-info/PKG-INFO +1 -1
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/pyproject.toml +1 -1
- archeo-2.0.0.dev6/archeo/constants/bayesian.py +0 -3
- archeo-2.0.0.dev6/archeo/constants/physics.py +0 -70
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/LICENSE +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/README.md +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/__main__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/ancestral_posterior.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/bayes_factor_curve.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/assume_independence.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/base.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/generic.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/interface.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/constants/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/constants/enum.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/annotation.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/bayesian/bayes_factor.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/distribution.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/math.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/physics/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/physics/binary.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/physics/black_hole.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/physics/mahapatra.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/physics/simulation.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/data_structures/visualization.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/postprocessing/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/postprocessing/dataframe.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/cli.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/forward/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/forward/compute_bayes_factor_curve.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/simulation/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/simulation/agnostic.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/simulation/n_generation.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/preset/simulation/second_generation.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/py.typed +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/simulation/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/simulation/simulate_merger.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/utils/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/utils/decorator.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/utils/env.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/utils/fs.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/utils/logger.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/utils/parallel.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/version.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/visualization/__init__.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/visualization/animation.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/visualization/distribution.py +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo.egg-info/SOURCES.txt +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo.egg-info/dependency_links.txt +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo.egg-info/requires.txt +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo.egg-info/top_level.txt +0 -0
- {archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/setup.cfg +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from pydantic import BaseModel, NonNegativeFloat
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
SPEED_OF_LIGHT = 299792.458 # km/s
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class _TypicalHostEscapeVelocityMeta(BaseModel):
|
|
11
|
+
v_esc: NonNegativeFloat # km s^-1
|
|
12
|
+
short: str
|
|
13
|
+
latex: str
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TypicalHostEscapeVelocity(enum.Enum):
|
|
17
|
+
"""Escape velocity (units: km s^-1)."""
|
|
18
|
+
|
|
19
|
+
GLOBULAR_CLUSTER = _TypicalHostEscapeVelocityMeta(v_esc=50.0, short="GC", latex=r"$v_{esc, GC}$")
|
|
20
|
+
MILKY_WAY = _TypicalHostEscapeVelocityMeta(v_esc=600.0, short="MW", latex=r"$v_{esc, MW}$")
|
|
21
|
+
NUCLEAR_STAR_CLUSTER = _TypicalHostEscapeVelocityMeta(v_esc=1500.0, short="NSC", latex=r"$v_{esc, NSC}$")
|
|
22
|
+
ELLIPTICAL_GALAXY = _TypicalHostEscapeVelocityMeta(v_esc=2500.0, short="EG", latex=r"$v_{esc, EG}$")
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def v_esc(self) -> float:
|
|
26
|
+
return self.value.v_esc
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def short(self) -> str:
|
|
30
|
+
return self.value.short
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def latex(self) -> str:
|
|
34
|
+
return self.value.latex
|
|
35
|
+
|
|
36
|
+
def compute_p2g(
|
|
37
|
+
self,
|
|
38
|
+
df: pd.DataFrame,
|
|
39
|
+
max_mass: float = 65.0,
|
|
40
|
+
kf_col: str = "k_f",
|
|
41
|
+
m1_col: str = "m_1",
|
|
42
|
+
m2_col: str = "m_2",
|
|
43
|
+
) -> float:
|
|
44
|
+
"""Probability of being 2nd-generation under this escape velocity."""
|
|
45
|
+
|
|
46
|
+
if df.empty:
|
|
47
|
+
return 0.0
|
|
48
|
+
|
|
49
|
+
mask = (df[kf_col] <= self.v_esc) & (df[m1_col] <= max_mass) & (df[m2_col] <= max_mass)
|
|
50
|
+
return mask.mean() * 100.0
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def latex_to_values(cls) -> dict[str, float]:
|
|
54
|
+
return {m.latex: m.v_esc for m in cls}
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def short_to_values(cls) -> dict[str, float]:
|
|
58
|
+
return {m.short: m.v_esc for m in cls}
|
|
@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
import pandas as pd
|
|
7
7
|
|
|
8
|
-
from archeo.constants.physics import
|
|
8
|
+
from archeo.constants.physics import TypicalHostEscapeVelocity
|
|
9
9
|
from archeo.data_structures.visualization import Labels, Padding
|
|
10
10
|
from archeo.utils.fs import check_and_create_dir
|
|
11
11
|
from archeo.utils.logger import get_logger
|
|
@@ -112,7 +112,7 @@ def add_escape_velocity(ax, v_max: float, y_max: float, log_xscale: bool = False
|
|
|
112
112
|
|
|
113
113
|
colors = iter(mcolors.TABLEAU_COLORS.keys())
|
|
114
114
|
# Plot vertical lines and labels (escape velocities)
|
|
115
|
-
for label, v_esc in
|
|
115
|
+
for label, v_esc in TypicalHostEscapeVelocity.latex_to_values().items():
|
|
116
116
|
# Skip if out of scope
|
|
117
117
|
if v_esc > v_max:
|
|
118
118
|
return
|
|
@@ -8,7 +8,7 @@ import numpy as np
|
|
|
8
8
|
import pandas as pd
|
|
9
9
|
import seaborn as sns
|
|
10
10
|
|
|
11
|
-
from archeo.constants.physics import
|
|
11
|
+
from archeo.constants.physics import TypicalHostEscapeVelocity
|
|
12
12
|
from archeo.data_structures.visualization import Labels, Padding
|
|
13
13
|
from archeo.utils.logger import get_logger
|
|
14
14
|
from archeo.visualization import base
|
|
@@ -363,7 +363,7 @@ def table_estimates(
|
|
|
363
363
|
data = {
|
|
364
364
|
"": dfs.keys(),
|
|
365
365
|
"Recovery Rate": [df["m_1"].notna().sum() / df.shape[0] for df in dfs.values()],
|
|
366
|
-
**{f"p2g_{v_esc.short
|
|
366
|
+
**{f"p2g_{v_esc.short}": [v_esc.compute_p2g(df) for df in dfs.values()] for v_esc in TypicalHostEscapeVelocity},
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
for col, name in col_to_names.items():
|
|
@@ -16,7 +16,7 @@ classifiers = [
|
|
|
16
16
|
"Operating System :: OS Independent"
|
|
17
17
|
]
|
|
18
18
|
keywords = ["black-holes", "gravitational-waves", "black-hole-archeology"]
|
|
19
|
-
version = "2.0.0.
|
|
19
|
+
version = "2.0.0.dev7"
|
|
20
20
|
readme = "README.md"
|
|
21
21
|
requires-python = ">=3.11,<3.14"
|
|
22
22
|
dependencies = [
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
|
|
3
|
-
import pandas as pd
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
SPEED_OF_LIGHT = 299792.458 # km/s
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class EscapeVelocity(enum.Enum):
|
|
10
|
-
"""Escape velocity (Unit in km s^-1)"""
|
|
11
|
-
|
|
12
|
-
GLOBULAR_CLUSTER = 50.0
|
|
13
|
-
MILKY_WAY = 600.0
|
|
14
|
-
NUCLEAR_STAR_CLUSTER = 1500.0
|
|
15
|
-
ELLIPTICAL_GALAXY = 2500.0
|
|
16
|
-
|
|
17
|
-
def label(self) -> str:
|
|
18
|
-
"""Return the escape velocity label"""
|
|
19
|
-
|
|
20
|
-
if self is EscapeVelocity.GLOBULAR_CLUSTER:
|
|
21
|
-
return "$v_{esc, GC}$"
|
|
22
|
-
|
|
23
|
-
if self is EscapeVelocity.MILKY_WAY:
|
|
24
|
-
return "$v_{esc, MW}$"
|
|
25
|
-
|
|
26
|
-
if self is EscapeVelocity.NUCLEAR_STAR_CLUSTER:
|
|
27
|
-
return "$v_{esc, NSC}$"
|
|
28
|
-
|
|
29
|
-
if self is EscapeVelocity.ELLIPTICAL_GALAXY:
|
|
30
|
-
return "$v_{esc, EG}$"
|
|
31
|
-
|
|
32
|
-
raise ValueError(f"Unknown escape velocity {self}")
|
|
33
|
-
|
|
34
|
-
def short(self) -> str:
|
|
35
|
-
"""Return the short name of the escape velocity"""
|
|
36
|
-
|
|
37
|
-
if self is EscapeVelocity.GLOBULAR_CLUSTER:
|
|
38
|
-
return "GC"
|
|
39
|
-
|
|
40
|
-
if self is EscapeVelocity.MILKY_WAY:
|
|
41
|
-
return "MW"
|
|
42
|
-
|
|
43
|
-
if self is EscapeVelocity.NUCLEAR_STAR_CLUSTER:
|
|
44
|
-
return "NSC"
|
|
45
|
-
|
|
46
|
-
if self is EscapeVelocity.ELLIPTICAL_GALAXY:
|
|
47
|
-
return "EG"
|
|
48
|
-
|
|
49
|
-
raise ValueError(f"Unknown escape velocity {self}")
|
|
50
|
-
|
|
51
|
-
def compute_p2g(self, df: pd.DataFrame) -> float:
|
|
52
|
-
"""Return the probability of
|
|
53
|
-
the black hole being a 2nd generation black hole
|
|
54
|
-
under different escape velocity conditions."""
|
|
55
|
-
|
|
56
|
-
if df.empty:
|
|
57
|
-
return 0.0
|
|
58
|
-
|
|
59
|
-
mask = (df["k_f"] <= self.value) & (df["m_1"] <= 65) & (df["m_2"] <= 65)
|
|
60
|
-
return mask.sum() / len(df) * 100.0
|
|
61
|
-
|
|
62
|
-
@classmethod
|
|
63
|
-
def to_vlines(cls) -> dict[str, float]:
|
|
64
|
-
"""Return a dictionary for vlines plotting
|
|
65
|
-
|
|
66
|
-
Returns:
|
|
67
|
-
vlines (Dict[str, float]): The escape velocity vlines.
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
return {esc_vel.label(): esc_vel.value for esc_vel in cls}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/bayes_factor_curve.py
RENAMED
|
File without changes
|
{archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/base.py
RENAMED
|
File without changes
|
{archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/generic.py
RENAMED
|
File without changes
|
{archeo-2.0.0.dev6 → archeo-2.0.0.dev7}/archeo/bayesian/importance_sampling/resampler/interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|