Commit 5f2ad8f3 authored by Dion Haefner's avatar Dion Haefner

correlation should now work in parallel

parent a8071eef
......@@ -61,8 +61,7 @@ class BaseConverter(object):
for v in self.data_dict.values():
if v.ndim != self.dim:
print(v.shape, self.dim)
raise ValueError("Data does not match field dimensions")
raise ValueError("Data shape ({}) does not match field dimensions ({})".format(", ".join(v.shape), self.dim))
h5_attrs = self._get_attributes()
groupname = self.ParClass.classname
write_parameter_file(groupname, self.data_dict, out_path,
......
......@@ -14,14 +14,13 @@ from dorie.utilities.text_to_bool import text_to_bool
def evaluate(iniinfo,runtime):
h5_path = iniinfo["generator.fft.outputPath"] + "/YField.h5"
with h5py.File(h5_path, 'r') as f:
y_data = np.squeeze(np.array(f.get("/YField"), dtype=np.float64))
y_data = np.array(f.get("/YField"), dtype=np.float64)
print("Operating on file: {}".format(h5_path))
# Calculate autocorrelation and correlation lengths
ac = statistics.autocorrelation(y_data)
rank = y_data.ndim
print(y_data.shape, iniinfo["generator.extensions"])
dx = np.array(iniinfo["generator.extensions"].split(), dtype=np.float) / y_data.shape
assert(len(dx) == rank)
cl = [integrate.simps(ac,dx=dxi,axis=i).flat[0] for i, dxi in enumerate(dx)][::-1]
......
......@@ -17,7 +17,7 @@ dimensions = 2, 3 | expand dim
extensions = 1 1, 1 1 1 | expand dim
[generator.fft]
outputPath = fft_fields/
outputPath = fft_fields | unique
N = 2048 2048, 128 128 128 | expand dim
variance = 0.2
correlationLengths = .004 .005, .05 .06 .08 | expand dim
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment