Skip to content

Commit e0a879f

Browse files
Clarify documentation for non-numbered input files
1 parent f7c99ab commit e0a879f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

screen19/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def prettyprint_procrunner(d):
9595
)
9696

9797

98-
def make_template(f):
98+
def make_template(f): # type: (str) -> (str, int)
9999
"""
100100
Generate a xia2-style filename template.
101101
@@ -104,17 +104,22 @@ def make_template(f):
104104
before the file extension.
105105
For example, the filename example_01_0001.cbf becomes example_01_####.cbf.
106106
107+
If the input data are in a single file and its name doesn't match the above
108+
template, the resulting filename template is simply the input file name and the
109+
resultant image number is None.
110+
This might be the case for input data in NeXus NXmx HDF5 format, for example,
111+
where one typically passes a file with a name like example_master.h5.
112+
107113
:param f: Filename, with extension.
108-
:type f: str
109114
:return: Filename template, with extension; image number.
110-
:rtype: Tuple(str, int)
111115
"""
112116
# Split the file from its path
113117
directory, f = os.path.split(f)
114118
# Split off the file extension, assuming it begins at the first full stop,
115119
# also split the last contiguous group of digits off the filename root
116120
try:
117121
root, number, extension = re.split(r"([0-9#]+)(?=\.\w)", f, 1)
122+
# Catch the case where the input data file name doesn't match the numbered pattern.
118123
except ValueError:
119124
template = f
120125
image = None

0 commit comments

Comments
 (0)