24) -> None:
25
26 field = pd.read_csv(input_fileName, skiprows=1, sep=r"\s+", names=["x", "y", "z", "bx", "by", "bz"])
27
28 field_mask = field.copy()
29 field_mask[["bx", "by", "bz"]] = field_mask[["bx", "by", "bz"]] != 0
30
31 field_new = field.copy()
32
33 if args.sidesOnly:
34 temp_by = np.array(field_new["by"]).reshape([xSpace, ySpace, zSpace])
35 temp_by = gaussian_filter(temp_by, sigma=args.sigma)
36 field_new["by"] = temp_by.reshape(-1)
37 field_new["by"] = field_new["by"] * field_mask["by"]
38 rezult = field_new
39 else:
40 field_new[["bx", "by", "bz"]] = 0
41 index_range = np.random.choice(field_new.index, size=args.nCores)
42
43
44
45 field_new.loc[index_range, "by"] = np.random.uniform(-args.peak, args.peak, size=args.nCores)
46 temp_by = np.array(field_new["by"]).reshape([xSpace, ySpace, zSpace])
47 temp_by = gaussian_filter(temp_by, sigma=args.sigma)
48 field_new["by"] = temp_by.reshape(-1)
49 field_new["by"] = field_new["by"] * field_mask["by"]
50 rezult = field.copy()
51 rezult["by"] = rezult["by"] + rezult["by"] * field_new["by"] * args.fraction
52
53
54
55
56
57 rezult.to_csv(output, sep="\t", header=False, index=False)
58
59