Skip to content

Commit

Permalink
Docstrings for various functions
Browse files Browse the repository at this point in the history
  • Loading branch information
GarethCabournDavies committed Feb 5, 2024
1 parent 89b10bc commit 3b1dd80
Showing 1 changed file with 78 additions and 3 deletions.
81 changes: 78 additions & 3 deletions pycbc/events/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,19 @@ def assign_dq_val(self, key):
return dq_dict

def find_dq_val(self, trigs):
"""Get dq values for a specific ifo and times"""
"""Get dq values for a specific ifo and times
Parameters
----------
trigs: ReadByTempate or SingleDetTriggers object
Object containing information about the triggers to be
checked
Returns
-------
dq_val: numpy array
The value of the dq reweighting factor for each trigger
"""
time = trigs['end_time'].astype(int)
try:
tnum = trigs.template_num
Expand Down Expand Up @@ -1148,8 +1160,18 @@ def sensitive_volume_factor(self, sngls):
should be given by the volume of the sphere to which we are
sensitive.
This is then the cube of the sensitive distance (sigma), divided
by a benchmark volume.
Parameters
----------
sngls: tuple
Single-detector information, tuples of the (ifo, sngl_object),
where sngl_object is a ReadByTemplate object or similar.
Returns
-------
network_logvol: numpy.array
Array of values for the network log-volume factor. This is the
log of the cube of the sensitive distance (sigma), divided by
a benchmark volume.
"""
# Network sensitivity for a given coinc type is approximately
# determined by the least sensitive ifo
Expand All @@ -1171,6 +1193,18 @@ def logsignalrate_shared(self, sngls_info):
"""
Calculate the parts of the log signal rate which are shared by
both the single and coinc ranking statistics
Parameters
----------
sngls_info: tuple
Single-detector information, tuples of the (ifo, sngl_object),
where sngl_object is a ReadByTemplate object or similar.
Returns
-------
sr_factor: numpy.ndarray
Array of values to be added to the ranking statistic when
taking various signal rate factors into account
"""
# Other features affecting the signal rate
sr_factor = 0
Expand Down Expand Up @@ -1227,6 +1261,28 @@ def rank_stat_coinc(self, s, slide, step, to_shift,
**kwargs): # pylint:disable=unused-argument
"""
Calculate the coincident detection statistic.
Parameters
----------
s: list
List of (ifo, single detector statistic) tuples
slide: numpy array
The number of steps by which to shift each trigger
step: float
The size of each step, to be multiplied by to_shift
to_shift: list
List of integers indicating what multiples of the time shift will
be applied
kwargs: various
Key-word arguments to define different features and tunable
values in the statistic. Only time_addition is used here
Returns
-------
loglr: numpy.ndarray
The ranking statistic for each trigger based on the supplied
triggers, requested features and keyword arguments
"""
# ranking statistic is -ln(expected rate density of noise triggers)
# plus normalization constant
Expand Down Expand Up @@ -1294,6 +1350,25 @@ def coinc_lim_for_thresh(self, s, thresh, limifo,
rate calculation, we take the best-case scenario. By using the
best-case for signal rate in this calculation, some events are kept
at this point which are hopeless.
Parameters
----------
s: list
List of (ifo, single detector statistic) tuples
thresh: float
The threshold value to be checked against
limifo: string
The pivot detector, i.e. the one in which the sngl stat must
reach the value output by ths function
kwargs: various
Key-word arguments to define different features and tunable
values in the statistic. Only time_addition is used here
Returns
-------
numpy.array
The minimum snglstat values required in the 'pivot' detector
in order to reach the threshold specified
"""
# Safety against subclassing and not rethinking this
allowed_names = ['ExpFitStatistic']
Expand Down

0 comments on commit 3b1dd80

Please sign in to comment.