@ots22 sorry for the delay on this, yes that's exactly what observed. And thanks - I somehow missed that regex is required in that field!
Initially I just tried changing . to \\. as it was the only regex-critical I thought was in there but that still failed in the same way.
After copying the regex from the test with 10943 (ie: using filename_regexp=".*115048\\.mrc") the test succeeds instead. So looks like I'm just bad at regex!
I suspect a lot of the intended/potential userbase aren't regex experts though, so I'd like to float an idea:
Would it be possible (and easy) to add a regex flag argument to EmpiarSource?
If True, the filename_regexp would be interpreted as regexp
If False, the filename_regexp would be interpreted as a string (like you would provide to glob.glob to get a list of filepaths satisfying the string/wildcard conditions)
If possible, I believe this would make empiarreader more accessible to those new to coding/python. Also, it might be nice to throw a more easily interpretable error upon this failure, but I'm unsure of the optimal way to implement that. Let me know your thoughts!
@ots22 sorry for the delay on this, yes that's exactly what observed. And thanks - I somehow missed that regex is required in that field! Initially I just tried changing
.
to\\.
as it was the only regex-critical I thought was in there but that still failed in the same way. After copying the regex from the test with 10943 (ie: usingfilename_regexp=".*115048\\.mrc"
) the test succeeds instead. So looks like I'm just bad at regex!I suspect a lot of the intended/potential userbase aren't regex experts though, so I'd like to float an idea:
filename_regexp
would be interpreted as regexpfilename_regexp
would be interpreted as a string (like you would provide toglob.glob
to get a list of filepaths satisfying the string/wildcard conditions)If possible, I believe this would make empiarreader more accessible to those new to coding/python. Also, it might be nice to throw a more easily interpretable error upon this failure, but I'm unsure of the optimal way to implement that. Let me know your thoughts!
Originally posted by @JatGreer in https://github.com/alan-turing-institute/empiarreader/issues/22#issuecomment-1561553883