pwem.utils module
- pwem.utils.cleanFileName(fn, warn=True)[source]
Cleans any character that later on might cause shell parsing errors like “(“, “)”, ” ” and warns about it if warn is true.
- Parameters
fn – file to be cleaned
warn – Optional (True). Logs
- pwem.utils.fnMatching(itemId, filesDict, objType='Micrograph')[source]
Check if in an object (micrograph, ctf, etc…) its files are matched
- Parameters
itemId – Is micName, baseName, tsId,…(is not objId)
filesDict – The keys are the base name of the file to import without the extension, and the values can be a path (e.g. path of the ctf files when importing ctf) or an object (e.g. micrographs when importing coordinates).
objType – This parameter is informative to complete the log messages to know what is being imported.
- Returns
A tuple with the key and the value of filesDict that matches itemId
- pwem.utils.round_to_nearest(number, base)[source]
- Rounds number to the nearest integer: E.g: pass base=5 to round to the nearest
number multiple of 5
- Parameters
number – number to be rounded
base – integer to limit the rounding to
- pwem.utils.runProgram(program, params)[source]
Runs an em program setting its environment matching a prefix
- pwem.utils.splitRange(minValue, maxValue, splitNum=10, roundTo=2)[source]
returns a list of “splitNum” items with values ranging from minValue to maxValue, equally divided :param minValue: value to start from :param maxValue: value to stop :param splitNum: number of splits, limits included :param roundTo: default to 2, rounding decimal value :return: list with the split