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.

  • fn – file to be cleaned

  • warn – Optional (True). Logs

pwem.utils.convertPixToLength(samplingRate, length)[source]
pwem.utils.getMatchingFiles(path, sort=False)[source]
pwem.utils.loadSetFromDb(dbName, dbPrefix='')[source]
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

  • 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