Skip to content

Commit b24a1e0

Browse files
authored
Merge pull request #2148 from willend/main
Safety valve for search with filter (returned bad list in search mcdoc powder)
2 parents b6ef8bc + b8aadab commit b24a1e0

File tree

10 files changed

+49
-21
lines changed

10 files changed

+49
-21
lines changed

mcstas-comps/examples/Risoe/linup-1/linup-1.instr renamed to mcstas-comps/examples/Risoe/TAS1_C1/TAS1_C1.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-1.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used as a diffractometer for monochromator rocking curves
1820
*

mcstas-comps/examples/Risoe/linup-2/linup-2.instr renamed to mcstas-comps/examples/Risoe/TAS1_C1_Tilt/TAS1_C1_Tilt.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-2.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used as a diffractometer for a collimator tilt alignment.
1820
*

mcstas-comps/examples/Risoe/linup-5/linup-5.instr renamed to mcstas-comps/examples/Risoe/TAS1_Diff_Powder/TAS1_Diff_Powder.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-5.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used as a diffractometer for an alignment study with a
1820
* powder sample.

mcstas-comps/examples/Risoe/linup-3/linup-3.instr renamed to mcstas-comps/examples/Risoe/TAS1_Diff_Slit/TAS1_Diff_Slit.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-3.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used as a diffractometer for a collimation alignment study with a
1820
* slit sample.

mcstas-comps/examples/Risoe/linup-4/linup-4.instr renamed to mcstas-comps/examples/Risoe/TAS1_Diff_Vana/TAS1_Diff_Vana.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-4.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used as a diffractometer for an alignment study with a
1820
* vanadium sample.

mcstas-comps/examples/Risoe/linup-7/linup-7.instr renamed to mcstas-comps/examples/Risoe/TAS1_Powder/TAS1_Powder.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-7.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used with a powder sample.
1820
*

mcstas-comps/examples/Risoe/linup-6/linup-6.instr renamed to mcstas-comps/examples/Risoe/TAS1_Vana/TAS1_Vana.instr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Origin: Risoe
1414
* %INSTRUMENT_SITE: Risoe
1515
*
16+
* Example formerly known as linup-6.instr
17+
*
1618
* The conventional cold-source triple-axis spectrometer TAS1 at Risoe National
1719
* Laboratory used with a vanadium sample.
1820
*

mcstas-comps/examples/SINE2020/McStas_PowderN/McStas_PowderN.instr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Instrument: McStas_PowdeN
2+
* Instrument: McStas_PowderN
33
*
44
* %I
55
* Written by: Peter Willendrup

mcstas-comps/examples/Union_validation/Powder_validation/Powder_validation.instr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Risoe National Laboratory, Roskilde, Denmark
66
* Institut Laue Langevin, Grenoble, France
77
*
8-
* Instrument: incoherent_validation
8+
* Instrument: Powder_validation
99
*
1010
* %Identification
1111
* Written by: Mads Bertelsen

tools/Python/mcdoc/mcdoc.py

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -923,27 +923,41 @@ def parse_and_filter(indir, namefilter=None, recursive=False, printlog=False):
923923
def write_doc_files_or_continue(comp_infos, instr_infos, comp_files, instr_files, printlog=False):
924924
''' Writes component and instrument docs files '''
925925
for i in range(len(comp_infos)):
926-
p = comp_infos[i]
927-
f = comp_files[i]
928-
doc = CompDocWriter(p)
929-
text = doc.create()
930-
h = pathlib.Path(os.path.splitext(f)[0] + '.html')
931-
h = pathlib.Path(str(h).replace(mccode_config.directories['resourcedir'], mccode_config.directories['docdir']))
932-
if printlog:
933-
print("writing doc file... %s" % h)
934-
write_file(h, text, failsilent=True)
926+
try:
927+
p = comp_infos[i]
928+
try:
929+
f = comp_files[i]
930+
except:
931+
f = comp_infos[i].filepath
932+
doc = CompDocWriter(p)
933+
text = doc.create()
934+
h = pathlib.Path(os.path.splitext(f)[0] + '.html')
935+
h = pathlib.Path(str(h).replace(mccode_config.directories['resourcedir'], mccode_config.directories['docdir']))
936+
if printlog:
937+
print("writing doc file... %s" % h)
938+
write_file(h, text, failsilent=True)
939+
except:
940+
print("Could not work on comp " + str(i) + " of " + str(len(comp_infos)) + ": " + comp_infos[i].name)
941+
pass
935942

936943
for i in range(len(instr_infos)):
937-
p = instr_infos[i]
938-
f = instr_files[i]
939-
doc = InstrDocWriter(p)
940-
text = doc.create()
941-
h = pathlib.Path(os.path.splitext(f)[0] + '.html')
942-
h = pathlib.Path(str(h).replace(mccode_config.directories['resourcedir'], mccode_config.directories['docdir']))
943-
if printlog:
944-
print("writing doc file... %s" % h)
945-
write_file(h, text, failsilent=True)
946-
944+
try:
945+
p = instr_infos[i]
946+
try:
947+
f = instr_infos[i].filepath
948+
except:
949+
f = instr_files[i]
950+
doc = InstrDocWriter(p)
951+
text = doc.create()
952+
h = pathlib.Path(os.path.splitext(f)[0] + '.html')
953+
h = pathlib.Path(str(h).replace(mccode_config.directories['resourcedir'], mccode_config.directories['docdir']))
954+
if printlog:
955+
print("writing doc file... %s" % h)
956+
write_file(h, text, failsilent=True)
957+
except:
958+
print("Could not work on instr " + str(i) + " of " + str(len(instr_infos)) + ": " + instr_infos[i].name)
959+
print(instr_infos[i].filepath)
960+
pass
947961

948962
def main(args):
949963
logging.basicConfig(level=logging.INFO)

0 commit comments

Comments
 (0)