text
stringlengths
0
828
to actually import the files
:param specfiles: the name of an ms-run file or a list of names
:type specfiles: str or [str, str, ...]
:param path: filedirectory used for loading and saving ``mrc`` files
""""""
for specfile in aux.toList(specfiles):
if specfile not in self.info:
self._addSpecfile(specfile, path)
else:
warntext = 'Error while calling ""MsrunContainer.addSpecfile()""'\
': ""%s"" is already present ""MsrunContainer.info""'\
% (specfile, )
warnings.warn(warntext)"
1927,"def _addSpecfile(self, specfile, path):
""""""Adds a new specfile entry to MsrunContainer.info. See also
:class:`MsrunContainer.addSpecfile()`.
:param specfile: the name of an ms-run file
:param path: filedirectory used for loading and saving ``mrc`` files
""""""
datatypeStatus = {'rm': False, 'ci': False, 'smi': False, 'sai': False,
'si': False
}
self.info[specfile] = {'path': path, 'status': datatypeStatus}"
1928,"def setPath(self, folderpath, specfiles=None):
""""""Changes the folderpath of the specified specfiles. The folderpath is
used for saving and loading of ``mrc`` files.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str]
:param folderpath: a filedirectory
""""""
if specfiles is None:
specfiles = [_ for _ in viewkeys(self.info)]
else:
specfiles = aux.toList(specfiles)
_containerSetPath(self, folderpath, specfiles)"
1929,"def removeData(self, specfiles=None, rm=False, ci=False, smi=False,
sai=False, si=False):
""""""Removes the specified datatypes of the specfiles from the
msrunContainer. To completely remove a specfile use
:func:`MsrunContainer.removeSpecfile`, which also removes the complete
entry from ``self.info``.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: None, str, [str, str]
:param rm: bool, True to select ``self.rmc``
:param ci: bool, True to select ``self.cic``
:param smi: bool, True to select ``self.smic``
:param sai: bool, True to select ``self.saic``
:param si: bool, True to select ``self.sic``
""""""
if specfiles is None:
specfiles = [_ for _ in viewkeys(self.info)]
else:
specfiles = aux.toList(specfiles)
#TODO: add a check if specfiles are present in the container
typeToContainer = {'rm': 'rmc', 'ci': 'cic', 'smi': 'smic',
'sai': 'saic', 'si': 'sic'
}
datatypes = self._processDatatypes(rm, ci, smi, sai, si)
for specfile in specfiles:
for datatype in datatypes:
datatypeContainer = typeToContainer[datatype]
dataContainer = getattr(self, datatypeContainer)
try:
del dataContainer[specfile]
except KeyError:
pass
finally:
self.info[specfile]['status'][datatype] = False"
1930,"def removeSpecfile(self, specfiles):
""""""Completely removes the specified specfiles from the
``msrunContainer``.
:param specfiles: the name of an ms-run file or a list of names. If None
all specfiles are selected.
:type specfiles: str, [str, str]
""""""
for specfile in aux.toList(specfiles):
for datatypeContainer in ['rmc', 'cic', 'smic', 'saic', 'sic']:
dataContainer = getattr(self, datatypeContainer)
try:
del dataContainer[specfile]
except KeyError:
pass
del self.info[specfile]"
1931,"def _processDatatypes(self, rm, ci, smi, sai, si):
""""""Helper function that returns a list of datatype strings, depending
on the parameters boolean value.
:param rm: bool, True to add ``rm``
:param ci: bool, True to add ``ci``
:param smi: bool, True to add ``smi``
:param sai: bool, True to add ``sai``
:param si: bool, True to add ``si``