Skip to content

Commit 00d3bf6

Browse files
committed
Added suggested chances
Added transient efficiency to DES detection probability changed DES.py name to des.py
1 parent cf62375 commit 00d3bf6

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/sorcha/modules/DESDetectionProbability.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
import numpy as np
2121

2222

23-
def DEScalcDetectionProbability(mag, limmag, c, k):
23+
def DEScalcDetectionProbability(mag, limmag, c, k, c_sharp=0.9555):
2424
"""
2525
Find the probability of a detection given a visual magnitude,
26-
limiting magnitude, a scaling factor c, and transition sharpness k. Equation from
26+
limiting magnitude, a scaling factor c, transition sharpness k and a transient efficiency. Equation from
2727
Bernardinelli et al., 2022
2828
2929
Parameters
@@ -40,13 +40,15 @@ def DEScalcDetectionProbability(mag, limmag, c, k):
4040
k : float or array of floats
4141
transition sharpness
4242
43+
c_sharp: float
44+
transient efficiency.
4345
Returns
4446
----------
4547
P : float or array of floats
4648
Probability of detection.
4749
"""
4850

49-
P = c / (1 + np.exp(k * (mag - limmag)))
51+
P = c_sharp * (c / (1 + np.exp(k * (mag - limmag))))
5052

5153
return P
5254

src/sorcha_cmdline/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def execute(args):
153153
update_activity_subclasses,
154154
update_lc_subclasses,
155155
)
156-
from sorcha.DES import runDESSimulation
156+
from sorcha.des import runDESSimulation
157157
import sys, os
158158

159159
# Extract the output file path now in order to set up logging.

tests/sorcha/test_DESDetectionProbaility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ def test_DEScalcDetectionProbability():
66
mag, limmag, c, k = 20,23.1,0.90,4.55
77
P = DEScalcDetectionProbability(mag,limmag,c,k)
88

9-
assert math.isclose(P, 0.8999993262,rel_tol=1e-10)
9+
assert math.isclose(P, 0.8599493561841001,rel_tol=1e-10)
1010

1111
mag, limmag, c, k = 24,23.1,0.90,3.99
1212
P = DEScalcDetectionProbability(mag,limmag,c,k)
1313

14-
assert math.isclose(P, 0.0241478958,rel_tol=1e-10)
14+
assert math.isclose(P, 0.0230733144369,rel_tol=1e-10)
1515

1616

1717

@@ -26,6 +26,6 @@ def test_DESDectionProbability():
2626
obs = pd.DataFrame(obs)
2727
P = DESDetectionProbability(obs)
2828

29-
assert math.isclose(P[0], 0.8999993262,rel_tol=1e-10)
29+
assert math.isclose(P[0], 0.8599493561841001,rel_tol=1e-10)
3030

31-
assert math.isclose(P[1], 0.0241478958,rel_tol=1e-10)
31+
assert math.isclose(P[1], 0.0230733144369,rel_tol=1e-10)

0 commit comments

Comments
 (0)