diff --git a/mcstas-comps/contrib/SNS_source_analytic.comp b/mcstas-comps/contrib/SNS_source_analytic.comp index 38e8b5e0a6..b17ebe65fe 100644 --- a/mcstas-comps/contrib/SNS_source_analytic.comp +++ b/mcstas-comps/contrib/SNS_source_analytic.comp @@ -809,84 +809,124 @@ INITIALIZE fprintf (stderr, "Error opening file\n"); exit (-1); } else { - printf ("%s\n", "File opened..."); + MPI_MASTER( + printf ("%s\n", "File opened..."); + ); } /* spectral parameters */ while ((fgets (line, linelength, fp) != NULL) && (strchr (line, '#') != NULL)) { - printf ("%s", line); + MPI_MASTER( + printf ("%s", line); + ); } kk = sscanf (line, " %le %le %le %le %le %le %le %le %le %le %le %le %le %le", ¶_sp[0], ¶_sp[1], ¶_sp[2], ¶_sp[3], ¶_sp[4], ¶_sp[5], ¶_sp[6], ¶_sp[7], ¶_sp[8], ¶_sp[9], ¶_sp[10], ¶_sp[11], ¶_sp[12], ¶_sp[13]); /* a parameter of emission time distribuation */ while ((fgets (line, linelength, fp) != NULL) && (strchr (line, '#') != NULL)) { - printf ("%s", line); + MPI_MASTER( + printf ("%s", line); + ); } kk = sscanf (line, " %le %le %le %le %le %le %le %le %le %le", ¶_a[0], ¶_a[1], ¶_a[2], ¶_a[3], ¶_a[4], ¶_a[5], ¶_a[6], ¶_a[7], ¶_a[8], ¶_a[9]); if (kk != 10) { - printf ("para_a: insufficient number of data entries read\n"); + MPI_MASTER( + printf ("para_a: insufficient number of data entries read\n"); + ); _ABORT (); } /* b parameter of emission time distribuation */ while ((fgets (line, linelength, fp) != NULL) && (strchr (line, '#') != NULL)) { - printf ("%s", line); + MPI_MASTER( + printf ("%s", line); + ); } kk = sscanf (line, " %le %le %le %le %le %le %le %le %le %le", ¶_b[0], ¶_b[1], ¶_b[2], ¶_b[3], ¶_b[4], ¶_b[5], ¶_b[6], ¶_b[7], ¶_b[8], ¶_b[9]); if (kk != 10) { - printf ("para_b: insufficient number of data entries read\n"); + MPI_MASTER( + printf ("para_b: insufficient number of data entries read\n"); + ); _ABORT (); } /* R parameter of emission time distribuation */ while ((fgets (line, linelength, fp) != NULL) && (strchr (line, '#') != NULL)) { - printf ("%s", line); + MPI_MASTER( + printf ("%s", line); + ); } kk = sscanf (line, " %le %le %le %le %le %le %le %le %le %le", ¶_R[0], ¶_R[1], ¶_R[2], ¶_R[3], ¶_R[4], ¶_R[5], ¶_R[6], ¶_R[7], ¶_R[8], ¶_R[9]); if (kk != 10) { - printf ("para_R: kk=%d insufficient number of data entries read\n", kk); + MPI_MASTER( + printf ("para_R: kk=%d insufficient number of data entries read\n", kk); + ); _ABORT (); } /* to parameter of emission time distribuation */ while ((fgets (line, linelength, fp) != NULL) && (strchr (line, '#') != NULL)) { - printf ("%s", line); + MPI_MASTER( + printf ("%s", line); + ); } kk = sscanf (line, " %le %le %le %le %le %le %le %le %le %le", ¶_to[0], ¶_to[1], ¶_to[2], ¶_to[3], ¶_to[4], ¶_to[5], ¶_to[6], ¶_to[7], ¶_to[8], ¶_to[9]); if (kk != 10) { - printf ("para_R: insufficient number of data entries read\n"); + MPI_MASTER( + printf ("para_R: insufficient number of data entries read\n"); + ); _ABORT (); } printf ("\n"); for (k = 0; k < 14; k++) { - printf (" para_sp(%d)=%e\n", k, para_sp[k]); + MPI_MASTER( + printf (" para_sp(%d)=%e\n", k, para_sp[k]); + ); } - printf ("\n"); + MPI_MASTER( + printf ("\n"); + ); for (k = 0; k < 10; k++) { - printf (" para_a(%d)=%e\n", k, para_a[k]); + MPI_MASTER( + printf (" para_a(%d)=%e\n", k, para_a[k]); + ); } - printf ("\n"); + MPI_MASTER( + printf ("\n"); + ); for (k = 0; k < 10; k++) { - printf (" para_b(%d)=%e\n", k, para_b[k]); + MPI_MASTER( + printf (" para_b(%d)=%e\n", k, para_b[k]); + ); } - printf ("\n"); + MPI_MASTER( + printf ("\n"); + ); for (k = 0; k < 8; k++) { - printf (" para_R(%d)=%e\n", k, para_R[k]); + MPI_MASTER( + printf (" para_R(%d)=%e\n", k, para_R[k]); + ); } - printf ("\n"); + MPI_MASTER( + printf ("\n"); + ); for (k = 0; k < 10; k++) { - printf (" para_to(%d)=%e\n", k, para_to[k]); + MPI_MASTER( + printf (" para_to(%d)=%e\n", k, para_to[k]); + ); } if (sample_E == 0) { CItot = prepare_cumulative_spectral_function (csfE, Emin, Emax, para_sp); if (CItot <= 0.0) { - printf (" choice of Emin and Emax gives zero neutron intensity\n"); + MPI_MASTER( + printf (" choice of Emin and Emax gives zero neutron intensity\n"); + ); _ABORT (); } // for(i=0;i<=1000;i++){ @@ -896,19 +936,29 @@ INITIALIZE /* some checks */ if (dist <= 0.0) { - printf (" dist must be greater zero\n"); + MPI_MASTER( + printf (" dist must be greater zero\n"); + ); _ABORT (); } else if (focus_xw <= 0.0) { - printf (" focus_xw must be greater zero\n"); + MPI_MASTER( + printf (" focus_xw must be greater zero\n"); + ); _ABORT (); } else if (focus_yh <= 0.0) { - printf (" focus_yh must be greater zero\n"); + MPI_MASTER( + printf (" focus_yh must be greater zero\n"); + ); _ABORT (); } else if (p_power <= 0) { - printf (" p_power must be greater zero\n"); + MPI_MASTER( + printf (" p_power must be greater zero\n"); + ); _ABORT (); } else if (n_pulses <= 0) { - printf (" n_pulses must be greater zero\n"); + MPI_MASTER( + printf (" n_pulses must be greater zero\n"); + ); _ABORT (); } diff --git a/mcstas-comps/examples/Mantid/SNS_ARCS_Mantid/SNS_ARCS_Mantid.instr b/mcstas-comps/examples/Mantid/SNS_ARCS_Mantid/SNS_ARCS_Mantid.instr index 4e3e8fbb77..663ae4494e 100644 --- a/mcstas-comps/examples/Mantid/SNS_ARCS_Mantid/SNS_ARCS_Mantid.instr +++ b/mcstas-comps/examples/Mantid/SNS_ARCS_Mantid/SNS_ARCS_Mantid.instr @@ -24,6 +24,8 @@ * B. Fultz,"Design and operation of the wide angular-range chopper spectrometer ARCS at the * Spallation Neutron Source", Review of Scientific Instruments, 83 , 015114 (2012) * +* %Example: Fermi_nu=420 Detector: Full_cyl_I=235445 +* * %Parameters * Fermi_nu: [Hz] Frequency of the Fermi chopper * T0_nu: [Hz] Frequency of the T0 chopper @@ -261,6 +263,10 @@ AT(0,0,LS) RELATIVE mod COMPONENT sampleMantid = Spot_sample(radius_o=0.01, h=0.05, pack = 1,xwidth=0, yheight=0, zthick=0, Eideal=Edes,w=Et,two_theta=ttheta,n_spots=4) AT (0.0,0.0,0.0) RELATIVE Sample_Arm +COMPONENT Full_cyl= Monitor_nD(xwidth=5.98,yheight=3.2,restore_neutron=1, + options="mantid banana, theta limits=[-28.0 135.38] bins=389 ,y limits=[-0.550 0.450] bins=128") +AT (0,0,0.00005) RELATIVE Sample_Arm + COMPONENT nD_Mantid_0= Monitor_nD(xwidth=5.9817,yheight=3.2,restore_neutron=1, filename="this", options="mantid banana, theta limits=[-28.0 135.38] bins=389 ,y limits=[-0.550 0.450] bins=128, neutron pixel min=0 t, list all neutrons", restore_neutron=1) AT (0,0,0.00005) RELATIVE Sample_Arm diff --git a/mcstas-comps/examples/SNS/Granroth_SNS_decoupled_poisoned/Granroth_SNS_decoupled_poisoned.instr b/mcstas-comps/examples/SNS/Granroth_SNS_decoupled_poisoned/Granroth_SNS_decoupled_poisoned.instr index 5017b24f13..d5e9c31267 100644 --- a/mcstas-comps/examples/SNS/Granroth_SNS_decoupled_poisoned/Granroth_SNS_decoupled_poisoned.instr +++ b/mcstas-comps/examples/SNS/Granroth_SNS_decoupled_poisoned/Granroth_SNS_decoupled_poisoned.instr @@ -16,7 +16,7 @@ * * Simple instrumentfile for estimating SNS brilliance, moderator is a the Granroth SNS_source applying linear interpolation in MCNPX tables. * -* Example: filename=source_sct091_tu_02_1.dat Detector: Brillmon_I=7.11736e+12 +* %Example: filename=source_sct091_tu_02_1.dat Detector: Brillmon_I=7.11736e+12 * * %Parameters * Lambda_min: [AA] Minimum wavelength produced at source diff --git a/mcstas-comps/examples/SNS/SNS_ARCS/SNS_ARCS.instr b/mcstas-comps/examples/SNS/SNS_ARCS/SNS_ARCS.instr index f5b44644c1..c5a407faec 100644 --- a/mcstas-comps/examples/SNS/SNS_ARCS/SNS_ARCS.instr +++ b/mcstas-comps/examples/SNS/SNS_ARCS/SNS_ARCS.instr @@ -24,8 +24,7 @@ * B. Fultz,"Design and operation of the wide angular-range chopper spectrometer ARCS at the * Spallation Neutron Source", Review of Scientific Instruments, 83 , 015114 (2012) * -* Example: -y Detector: Full_cyl_I=235445 -* (temporarily disabled on nightly test...) +* %Example: -y Detector: Full_cyl_I=235445 * * %Parameters * Fermi_nu: [Hz] Frequency of the Fermi chopper diff --git a/mcstas-comps/examples/SNS/SNS_analytic_test/SNS_analytic_test.instr b/mcstas-comps/examples/SNS/SNS_analytic_test/SNS_analytic_test.instr index 1ee8de6688..c59cf64c3c 100644 --- a/mcstas-comps/examples/SNS/SNS_analytic_test/SNS_analytic_test.instr +++ b/mcstas-comps/examples/SNS/SNS_analytic_test/SNS_analytic_test.instr @@ -19,7 +19,7 @@ * Simple test instrument for the SNS_source component. * Refer to SNS Source files. * -* Example: filename=source_sct091_tu_02_1.dat Detector: det_I=7.09416e+09 +* %Example: -y Detector: det_I=8.51297e+10 * * %Parameters * filename: [string] Source file @@ -48,8 +48,9 @@ INITIALIZE %{ #define LOADPATH_ STR(LOADPATH) sprintf(fullfile,"%s/%s",LOADPATH_,filename); -printf("Using the input file: %s\n", fullfile); - +MPI_MASTER( + printf("Using the input file: %s\n", fullfile); +); %} TRACE diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index 03426abfde..831a361090 100755 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -95,26 +95,30 @@ def save(self, infolder): text = json.dumps(self.get_json_repr(), indent=2) f = open(join(infolder, self.get_display_name()) + ".json", 'w').write(text) def load(self,testnb=0): - jsonfile=os.path.join(os.path.dirname(self.localfile),self.get_display_name()+'.json') - f = open(jsonfile, "r", encoding="utf-8") - obj = json.load(f) - # # Populate test - self.displayname=obj['displayname'] - self.sourcefile=obj['sourcefile'] - self.localfile=obj['localfile'] - self.instrname=obj['instrname'] - self.testnb=obj['testnb'] - self.parvals=obj['parvals'] - self.detector=obj['detector'] - self.targetval=obj['targetval'] - self.testval=obj['testval'] - self.linted=obj['linted'] - self.compiled=obj['compiled'] - self.compiletime=obj['compiletime'] - self.didrun=obj['didrun'] - self.runtime=obj['runtime'] - self.errmsg=obj['errmsg'] - + jsonfile=pathlib.Path(os.path.join(os.path.dirname(self.localfile),self.get_display_name()+'.json')) + if jsonfile.is_file(): + f = open(jsonfile, "r", encoding="utf-8") + obj = json.load(f) + # # Populate test + self.displayname=obj['displayname'] + self.sourcefile=obj['sourcefile'] + self.localfile=obj['localfile'] + self.instrname=obj['instrname'] + self.testnb=obj['testnb'] + self.parvals=obj['parvals'] + self.detector=obj['detector'] + self.targetval=obj['targetval'] + self.testval=obj['testval'] + self.linted=obj['linted'] + self.compiled=obj['compiled'] + self.compiletime=obj['compiletime'] + self.didrun=obj['didrun'] + self.runtime=obj['runtime'] + self.errmsg=obj['errmsg'] + return True + else: + return False + def get_display_name(self): if self.testnb > 1: return self.instrname + "_%d" % self.testnb @@ -251,8 +255,8 @@ def mccode_test(branchdir, testdir, limitinstrs=None, instrfilter=None, compfilt populated=[] for t in instrtests: if t.testnb >= 0: - t.load(t.testnb) - populated.append(t) + if t.load(t.testnb)==True: + populated.append(t) tests = tests + populated pass