Converting to and from other data formats

modifinder.convert.compound_to_dict(compound)[source]

Convert a Compound object to a dictionary

modifinder.convert.spectrum_to_dict(spectrum)[source]

Convert a Spectrum object to a dictionary

modifinder.convert.to_compound(data=None, use_object=None, **kwargs)[source]

Make a Compound object from the data

Parameters:
  • data (object to be converted) –

    Current supported types are:

    Compound object (return the same object, for copying you can pass use_object or use .copy() method) USI string dictionary-of-data

  • use_object (object, optional) – If a Compound object is passed, this object will be used to create the new object.

  • kwargs (keyword arguments) – If no data is passed, the keyword arguments will be used to create the object.

modifinder.convert.to_spectrum(data=None, use_object=None, needs_parse=True, **kwargs)[source]

Make a Spectrum object from the data

Parameters:
  • data (object to be converted) –

    Current supported types are:

    Spectrum object (return the same object, for copying you can pass use_object or use .copy() method) USI string dictionary-of-data

  • use_object (object, optional) – If a Spectrum object is passed, this object will be used to create the new object.

  • needs_parse (bool, default is True) – If True, the dict data will be parsed to a universal format