Skip to content

Commit

Permalink
feat(sensitivity): add frac lost to SystemSensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
jrs65 committed Mar 10, 2020
1 parent 8854536 commit cdfa35b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 6 additions & 3 deletions draco/analysis/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ def process(self, data):
dnu = np.median(data.index_map["freq"]["width"]) * 1e6

if ("flags" in data) and ("frac_lost" in data["flags"]):
frac_lost = data["flags"]["frac_lost"][:][:, np.newaxis, :]
frac_lost = data["flags"]["frac_lost"][:]
else:
frac_lost = 0.0
frac_lost = np.zeros((1, 1), dtype=np.float32)

nint = dnu * tint * (1.0 - frac_lost)
nint = dnu * tint * (1.0 - frac_lost[:, np.newaxis, :])

# Normalize by the number of independent samples
# and the total number of baselines squared
Expand Down Expand Up @@ -257,4 +257,7 @@ def process(self, data):
# Save the total number of baselines that were averaged in the weight dataset
metrics.weight[:] = counter

# Save the fraction of missing samples
metrics.frac_lost[:] = frac_lost

return metrics
10 changes: 10 additions & 0 deletions draco/core/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,12 @@ class SystemSensitivity(TODContainer):
"initialise": True,
"distributed": True,
},
"frac_lost": {
"axes": ["freq", "time"],
"dtype": np.float32,
"initialise": True,
"distributed": True,
},
}

@property
Expand All @@ -810,6 +816,10 @@ def radiometer(self):
def weight(self):
return self.datasets["weight"]

@property
def frac_lost(self):
return self.datasets["frac_lost"]

@property
def freq(self):
return self.index_map["freq"]["centre"]
Expand Down

0 comments on commit cdfa35b

Please sign in to comment.