pyerrors 2.11.0__tar.gz → 2.11.1__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.
Files changed (35) hide show
  1. {pyerrors-2.11.0 → pyerrors-2.11.1}/PKG-INFO +1 -1
  2. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/obs.py +31 -6
  3. pyerrors-2.11.1/pyerrors/version.py +1 -0
  4. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors.egg-info/PKG-INFO +1 -1
  5. pyerrors-2.11.0/pyerrors/version.py +0 -1
  6. {pyerrors-2.11.0 → pyerrors-2.11.1}/LICENSE +0 -0
  7. {pyerrors-2.11.0 → pyerrors-2.11.1}/README.md +0 -0
  8. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/__init__.py +0 -0
  9. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/correlators.py +0 -0
  10. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/covobs.py +0 -0
  11. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/dirac.py +0 -0
  12. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/fits.py +0 -0
  13. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/__init__.py +0 -0
  14. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/bdio.py +0 -0
  15. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/dobs.py +0 -0
  16. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/hadrons.py +0 -0
  17. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/json.py +0 -0
  18. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/misc.py +0 -0
  19. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/openQCD.py +0 -0
  20. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/pandas.py +0 -0
  21. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/sfcf.py +0 -0
  22. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/input/utils.py +0 -0
  23. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/integrate.py +0 -0
  24. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/linalg.py +0 -0
  25. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/misc.py +0 -0
  26. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/mpm.py +0 -0
  27. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/roots.py +0 -0
  28. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors/special.py +0 -0
  29. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors.egg-info/SOURCES.txt +0 -0
  30. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors.egg-info/dependency_links.txt +0 -0
  31. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors.egg-info/requires.txt +0 -0
  32. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyerrors.egg-info/top_level.txt +0 -0
  33. {pyerrors-2.11.0 → pyerrors-2.11.1}/pyproject.toml +0 -0
  34. {pyerrors-2.11.0 → pyerrors-2.11.1}/setup.cfg +0 -0
  35. {pyerrors-2.11.0 → pyerrors-2.11.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerrors
3
- Version: 2.11.0
3
+ Version: 2.11.1
4
4
  Summary: Error propagation and statistical analysis for Monte Carlo simulations
5
5
  Home-page: https://github.com/fjosw/pyerrors
6
6
  Author: Fabian Joswig
@@ -1138,7 +1138,7 @@ def _intersection_idx(idl):
1138
1138
  return idinter
1139
1139
 
1140
1140
 
1141
- def _expand_deltas_for_merge(deltas, idx, shape, new_idx):
1141
+ def _expand_deltas_for_merge(deltas, idx, shape, new_idx, scalefactor):
1142
1142
  """Expand deltas defined on idx to the list of configs that is defined by new_idx.
1143
1143
  New, empty entries are filled by 0. If idx and new_idx are of type range, the smallest
1144
1144
  common divisor of the step sizes is used as new step size.
@@ -1154,15 +1154,20 @@ def _expand_deltas_for_merge(deltas, idx, shape, new_idx):
1154
1154
  Number of configs in idx.
1155
1155
  new_idx : list
1156
1156
  List of configs that defines the new range, has to be sorted in ascending order.
1157
+ scalefactor : float
1158
+ An additional scaling factor that can be applied to scale the fluctuations,
1159
+ e.g., when Obs with differing numbers of replica are merged.
1157
1160
  """
1158
-
1159
1161
  if type(idx) is range and type(new_idx) is range:
1160
1162
  if idx == new_idx:
1161
- return deltas
1163
+ if scalefactor == 1:
1164
+ return deltas
1165
+ else:
1166
+ return deltas * scalefactor
1162
1167
  ret = np.zeros(new_idx[-1] - new_idx[0] + 1)
1163
1168
  for i in range(shape):
1164
1169
  ret[idx[i] - new_idx[0]] = deltas[i]
1165
- return np.array([ret[new_idx[i] - new_idx[0]] for i in range(len(new_idx))]) * len(new_idx) / len(idx)
1170
+ return np.array([ret[new_idx[i] - new_idx[0]] for i in range(len(new_idx))]) * len(new_idx) / len(idx) * scalefactor
1166
1171
 
1167
1172
 
1168
1173
  def derived_observable(func, data, array_mode=False, **kwargs):
@@ -1243,6 +1248,25 @@ def derived_observable(func, data, array_mode=False, **kwargs):
1243
1248
  new_r_values[name] = func(tmp_values, **kwargs)
1244
1249
  new_idl_d[name] = _merge_idx(idl)
1245
1250
 
1251
+ def _compute_scalefactor_missing_rep(obs):
1252
+ """
1253
+ Computes the scale factor that is to be multiplied with the deltas
1254
+ in the case where Obs with different subsets of replica are merged.
1255
+ Returns a dictionary with the scale factor for each Monte Carlo name.
1256
+
1257
+ Parameters
1258
+ ----------
1259
+ obs : Obs
1260
+ The observable corresponding to the deltas that are to be scaled
1261
+ """
1262
+ scalef_d = {}
1263
+ for mc_name in obs.mc_names:
1264
+ mc_idl_d = [name for name in obs.idl if name.startswith(mc_name + '|')]
1265
+ new_mc_idl_d = [name for name in new_idl_d if name.startswith(mc_name + '|')]
1266
+ if len(mc_idl_d) > 0 and len(mc_idl_d) < len(new_mc_idl_d):
1267
+ scalef_d[mc_name] = sum([len(new_idl_d[name]) for name in new_mc_idl_d]) / sum([len(new_idl_d[name]) for name in mc_idl_d])
1268
+ return scalef_d
1269
+
1246
1270
  if 'man_grad' in kwargs:
1247
1271
  deriv = np.asarray(kwargs.get('man_grad'))
1248
1272
  if new_values.shape + data.shape != deriv.shape:
@@ -1280,7 +1304,7 @@ def derived_observable(func, data, array_mode=False, **kwargs):
1280
1304
  d_extracted[name] = []
1281
1305
  ens_length = len(new_idl_d[name])
1282
1306
  for i_dat, dat in enumerate(data):
1283
- d_extracted[name].append(np.array([_expand_deltas_for_merge(o.deltas.get(name, np.zeros(ens_length)), o.idl.get(name, new_idl_d[name]), o.shape.get(name, ens_length), new_idl_d[name]) for o in dat.reshape(np.prod(dat.shape))]).reshape(dat.shape + (ens_length, )))
1307
+ d_extracted[name].append(np.array([_expand_deltas_for_merge(o.deltas.get(name, np.zeros(ens_length)), o.idl.get(name, new_idl_d[name]), o.shape.get(name, ens_length), new_idl_d[name], _compute_scalefactor_missing_rep(o).get(name.split('|')[0], 1)) for o in dat.reshape(np.prod(dat.shape))]).reshape(dat.shape + (ens_length, )))
1284
1308
  for name in new_cov_names:
1285
1309
  g_extracted[name] = []
1286
1310
  zero_grad = _Zero_grad(new_covobs_lengths[name])
@@ -1302,11 +1326,12 @@ def derived_observable(func, data, array_mode=False, **kwargs):
1302
1326
  new_grad[name] += np.tensordot(deriv[i_val + (i_dat, )], dat)
1303
1327
  else:
1304
1328
  for j_obs, obs in np.ndenumerate(data):
1329
+ scalef_d = _compute_scalefactor_missing_rep(obs)
1305
1330
  for name in obs.names:
1306
1331
  if name in obs.cov_names:
1307
1332
  new_grad[name] = new_grad.get(name, 0) + deriv[i_val + j_obs] * obs.covobs[name].grad
1308
1333
  else:
1309
- new_deltas[name] = new_deltas.get(name, 0) + deriv[i_val + j_obs] * _expand_deltas_for_merge(obs.deltas[name], obs.idl[name], obs.shape[name], new_idl_d[name])
1334
+ new_deltas[name] = new_deltas.get(name, 0) + deriv[i_val + j_obs] * _expand_deltas_for_merge(obs.deltas[name], obs.idl[name], obs.shape[name], new_idl_d[name], scalef_d.get(name.split('|')[0], 1))
1310
1335
 
1311
1336
  new_covobs = {name: Covobs(0, allcov[name], name, grad=new_grad[name]) for name in new_grad}
1312
1337
 
@@ -0,0 +1 @@
1
+ __version__ = "2.11.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyerrors
3
- Version: 2.11.0
3
+ Version: 2.11.1
4
4
  Summary: Error propagation and statistical analysis for Monte Carlo simulations
5
5
  Home-page: https://github.com/fjosw/pyerrors
6
6
  Author: Fabian Joswig
@@ -1 +0,0 @@
1
- __version__ = "2.11.0"
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