itcsimlib.mass_spec module¶
Extension of Ising classes for fitting mass spectrometry data.
-
class
itcsimlib.mass_spec.MSExperiment(path, T=298.15, sigma=0.05, title=None, lattice_name='Lattice', ligand_name='Ligand')[source]¶ Bases:
itcsimlib.itc_experiment.ITCExperimentBaseA class that represents a specific mass spec experiment, i.e. weights of different stoichiometry populations
-
chisq¶ If a fit has been generated, the reduced chi-squared goodness-of-fit value.
Type: float
-
T¶ The experimental temperature (in Kelvin).
Type: float
-
Lattice¶ The name of the lattice component (if it exists, read from the experiment file)
Type: string
-
Ligand¶ The name of the ligand component (if it exists, read from the experiment file)
Type: string
-
Concentrations¶ The concentrations of the components at each titration point
Type: list of dicts
-
PopIntens¶ The normalized intensities of each lattice+ligand stoichiometry at each set of component concentrations
Type: ndarray
-
PopSigmas¶ The uncertainty in the measured intensity of each lattice+ligand stoichiometry at each set of component concentrations
Type: ndarray
-
PopFits¶ The fitted intensities (if calculated) of each lattice+ligand stoichiometry at each set of component concentrations
Type: ndarray
Notes
This class abuses several of the usual ITCExperimentBase attributes in a rather dirty fashion - it won’t as a simple replacement for many itcsimlib routines, but basic fitting should be OK
-
make_plot(hardcopy=False, hardcopydir='.', hardcopyprefix='', hardcopytype='png')[source]¶ Generate a stacked plot of the experimental populations, the fitted populations, and the residuals between the two.
Parameters: - hardcopy (boolean) – Display the fit to the screen, or write it to a file?
- hardcopydir (string) – The directory to write the hardcopy to.
- hardcopyprefix (string) – A prefix to append to the experiment’s title when generating the output plot filename.
- hardcopytype (string) – The output format for the plot (availability is dependent upon what backends matplotlib was compiled with).
Returns: Return type: None
-
make_population_plot(dataset='fit', hardcopy=False, hardcopydir='.', hardcopyprefix='', hardcopytype='png')[source]¶
-
export_to_file(path)[source]¶ Export the experimental data and any fit to the specified file path.
Parameters: path (string) – The filesystem path to write the output to. Returns: Return type: None
-
get_chisq(pops, writeback=False)[source]¶ Calculate the chi-square goodness-of-fit between the experimental population abundances and the fitted ones.
Parameters: - pops (ndarray) – The normalized abundances of each lattice+ligand stoichiometries at each of the provided component concentrations.
- writeback (boolean) – Update the experiment’s simulated heat attribute (dQ_fit) with the provided Qs?
Returns: The goodness of the fit, as a reduced chi-square.
Return type: float
Notes
This method takes advantage of the fact that ITCSim doesn’t inspect the data that is returned by the model, and instead lets the associated experiment handle the goodness-of-fit. The only caveat of course is that model must return the same number of lattice+ligand stoichiometries as are present in the experimental results. Variances (sigma**2) must have been precomputed as self.PopSigmas (perhaps should be self.PopVariances?)
-
-
class
itcsimlib.mass_spec.MSExperimentSynthetic(lattice_concs, ligand_concs, T=298.15, noise=0.02, title=None, lattice_name='Lattice', ligand_name='Ligand')[source]¶ Bases:
itcsimlib.mass_spec.MSExperimentA MSExperiment-derived class that can be used to simulate a mass spec experiment
-
class
itcsimlib.mass_spec.MSModel(model)[source]¶ Bases:
itcsimlib.model_ising.IsingClass used to convert an existing Ising-based binding model to one that returns lattice+ligand stoichiometry abundances suitable for fitting mass spec data.
Note #1: Inherits all attributes of the provided class instance, serves as a passthru using the provided class’ set_energies(). Note #2: If the provided class instance has overwritten any of the Ising class methods (other than set_energies), you’re best off not using this convertor class.
-
set_energies(T0, T)[source]¶ Update the parent model parameters with whatever we currently have, and set the parent model config energies
-
Q(T0, T, concentrations)[source]¶ Return a 2D numpy array consisting of the base model’s relative stoichiometries at each of the provided component concentrations.
Parameters: - T0 (float) – The reference temperature of the simulation.
- T (float) – The temperature of the experiment to simulate.
- concentrations (list of dicts) – The concentrations of each component at each titration point.
Returns: The normalized abundances of each lattice+ligand stoichiometries at each of the provided component concentrations.
Return type: ndarray
-