Skip to content

Commit 24fabbe

Browse files
committed
Add commonTransform to OnePointFunctions.computeDerivedCorrelators
1 parent 0f7a6fa commit 24fabbe

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/isle/meas/onePointFunctions.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ def save(self, h5group):
129129
subGroup[name] = correlator
130130

131131
@classmethod
132-
def computeDerivedCorrelators(cls, measurements):
132+
def computeDerivedCorrelators(cls, measurements, commonTransform):
133133
r"""!
134134
\param measurements a dictionary of measurements that has measurements of `"np"` and `"nh"`
135+
\param commonTransform A spatial matrix used to transform *all* correlators passed in through `measurements`,
136+
i.e. the `transform` attribute of measurement objects.
135137
136138
Measurements of one-point functions \f$\rho_x\f$, \f$n_x\f$,
137139
and \f$S^3_x\f$ are built from measurements of \f$n^p_x\f$ and \f$n^h_x\f$
@@ -142,16 +144,20 @@ def computeDerivedCorrelators(cls, measurements):
142144
```python
143145
# meas is an instance of OnePointFunctions
144146
derived = isle.meas.OnePointFunctions.computeDerivedCorrelators(
145-
{name: np.asarray(corr) for name, corr in meas.correlators.items()})
147+
{name: np.asarray(corr) for name, corr in meas.correlators.items()},
148+
meas.transform)
146149
```
147150
148151
\returns `dict` with additional one-point functions, built from those already computed.
149152
"""
150153

154+
nx = next(iter(measurements.values())).shape[1]
155+
U = commonTransform if commonTransform is not None else np.eye((nx, nx))
156+
151157
derived = dict()
152158

153159
derived["rho"] = measurements["np"] - measurements["nh"]
154160
derived["n"] = measurements["np"] + measurements["nh"]
155-
derived["S3"] = 0.5 * (1 - derived["n"])
161+
derived["S3"] = 0.5 * (np.expand_dims(np.sum(U, axis=1), axis=0) - derived["n"])
156162

157163
return derived

0 commit comments

Comments
 (0)