Skip to content

Commit 761e1b1

Browse files
authored
Merge pull request #51 from neutrons/pd245_add_bank_by_bank_nexus_file_read
Pd245 add bank by bank nexus file read
2 parents 2230801 + 459b8cb commit 761e1b1

File tree

11 files changed

+48601
-443
lines changed

11 files changed

+48601
-443
lines changed

pystog/cli.py

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def pystog_cli(kwargs=None):
2929
args = parser.parse_args()
3030
if args.json:
3131
print("loading config from '%s'" % args.json)
32-
with open(args.json, 'r') as f:
32+
with open(args.json, "r") as f:
3333
kwargs = json.load(f)
3434

3535
else:
@@ -41,34 +41,37 @@ def pystog_cli(kwargs=None):
4141

4242
# Merge S(Q) files
4343
stog = StoG(**kwargs)
44-
stog.read_all_data(skiprows=3)
45-
stog.merge_data()
46-
stog.write_out_merged_sq()
47-
48-
# Initial S(Q) -> g(r) transform
49-
stog.transform_merged()
50-
stog.write_out_merged_gr()
51-
52-
# TODO: Add the lowR minimizer here
53-
# print stog.get_lowR_mean_square()
54-
55-
# Set the S(Q) and g(r) if no Fourier Filter
56-
r = stog.r_master[stog.gr_title]
57-
q = stog.q_master[stog.sq_title]
58-
sq = stog.sq_master[stog.sq_title]
59-
gr_out = stog.gr_master[stog.gr_title]
60-
61-
# Apply Fourier Filter
62-
if "FourierFilter" in kwargs:
63-
q, sq, r, gr_out = stog.fourier_filter()
64-
65-
# Apply Lorch Modification
66-
if kwargs["LorchFlag"]:
67-
r, gr_out = stog.apply_lorch(q, sq, r)
68-
69-
# Apply final scale number
70-
stog._add_keen_fq(q, sq)
71-
stog._add_keen_gr(r, gr_out)
44+
if "NexusFile" in kwargs:
45+
stog.read_all_nexus_file_banks()
46+
else:
47+
stog.read_all_data(skiprows=3)
48+
stog.merge_data()
49+
stog.write_out_merged_sq()
50+
51+
# Initial S(Q) -> g(r) transform
52+
stog.transform_merged()
53+
stog.write_out_merged_gr()
54+
55+
# TODO: Add the lowR minimizer here
56+
# print stog.get_lowR_mean_square()
57+
58+
# Set the S(Q) and g(r) if no Fourier Filter
59+
r = stog.r_master[stog.gr_title]
60+
q = stog.q_master[stog.sq_title]
61+
sq = stog.sq_master[stog.sq_title]
62+
gr_out = stog.gr_master[stog.gr_title]
63+
64+
# Apply Fourier Filter
65+
if "FourierFilter" in kwargs:
66+
q, sq, r, gr_out = stog.fourier_filter()
67+
68+
# Apply Lorch Modification
69+
if kwargs["LorchFlag"]:
70+
r, gr_out = stog.apply_lorch(q, sq, r)
71+
72+
# Apply final scale number
73+
stog._add_keen_fq(q, sq)
74+
stog._add_keen_gr(r, gr_out)
7275

7376

7477
if __name__ == "__main__":

0 commit comments

Comments
 (0)