### Install with user permissions Source: https://kimopack.readthedocs.io/en/latest/_sources/Installation.rst.txt Use the --user flag if the installation fails due to insufficient system rights. ```text $ conda create --name kimoPack $ conda activate kimokack $ pip install KiMoPack h5py tables keyboard nbopen python-pptx --user ``` -------------------------------- ### Install with user permissions Source: https://kimopack.readthedocs.io/en/latest/Installation.html Use this command if standard installation fails due to insufficient system rights. ```bash $ conda create --name kimoPack $ conda activate kimokack $ pip install KiMoPack h5py tables keyboard nbopen python-pptx --user ``` -------------------------------- ### Install KiMoPack with recommended dependencies Source: https://kimopack.readthedocs.io/en/latest/_sources/Installation.rst.txt Installs KiMoPack along with optional packages for file handling, presentation export, and notebook integration. ```text $ pip install KiMoPack h5py tables nbopen python-pptx (windows) python -m nbopen.install_win (Linux) python3 -m nbopen.install_xdg (MacOS) Clone the repository and run ./osx-install.sh ``` -------------------------------- ### Install KiMoPack via pip Source: https://kimopack.readthedocs.io/en/latest/Installation.html Standard installation command using the pip package manager. ```bash $ pip install KiMoPack ``` -------------------------------- ### Install KiMoPack with recommended dependencies Source: https://kimopack.readthedocs.io/en/latest/Installation.html Installs KiMoPack along with optional packages for file handling, presentation export, and keyboard interrupts. ```bash $ pip install KiMoPack h5py tables nbopen python-pptx ``` -------------------------------- ### Install KiMoPack via conda Source: https://kimopack.readthedocs.io/en/latest/Installation.html Installation command using the conda package manager from the erdzeichen channel. ```bash $ conda install -c erdzeichen kimopack ``` -------------------------------- ### Create and configure a local conda environment Source: https://kimopack.readthedocs.io/en/latest/Installation.html Sets up a dedicated environment and installs KiMoPack with all recommended dependencies. ```bash $ conda create --name kimoPack $ conda activate kimokack $ pip install KiMoPack h5py tables keyboard nbopen python-pptx ``` -------------------------------- ### Initialize lmfit Parameters Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt The starting point for defining parameters for a fit. ```python ta.par=lmfit.Parameters() ``` -------------------------------- ### Upgrade KiMoPack Source: https://kimopack.readthedocs.io/en/latest/Installation.html Updates an existing installation to the latest version. ```bash $ pip install KiMoPack -U ``` -------------------------------- ### Install pytables via conda-forge Source: https://kimopack.readthedocs.io/en/latest/Installation.html Resolves potential issues with pytables by using the conda-forge distribution. ```bash conda install -c conda-forge pytables ``` -------------------------------- ### Download KiMoPack resources Source: https://kimopack.readthedocs.io/en/latest/_sources/Installation.rst.txt Use these commands in a Python console to fetch either the full set of notebooks and tutorials or only the workflow tools. ```python import KiMoPack; KiMoPack.download_all() ``` ```python import KiMoPack; KiMoPack.download_notebooks() ``` -------------------------------- ### Download KiMoPack notebooks via command line Source: https://kimopack.readthedocs.io/en/latest/Installation.html Use these one-liners to download workflow tools into your current directory. ```bash ipython -c "import KiMoPack; KiMoPack.download_notebooks()" python -c "import KiMoPack; KiMoPack.download_notebooks()" python3 -c "import KiMoPack; KiMoPack.download_notebooks()" ``` -------------------------------- ### Create a conda environment with specific Python version Source: https://kimopack.readthedocs.io/en/latest/Installation.html Sets up an environment with a specific Python version and Jupyter tools. ```bash $ conda create --name kimopack python=3.11 ipython jupyterlab jupyter $ conda activate kimopack $ pip install KiMoPack h5py tables keyboard nbopen python-pptx ``` -------------------------------- ### Save Project as HDF5 Source: https://kimopack.readthedocs.io/en/latest/Saving.html Serializes the project state, including parameters, fit results, and raw data, into an HDF5 file. External fit functions must be re-assigned after reloading. ```python self.Save_project() ``` -------------------------------- ### Global fitting with multiple files Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Perform global fitting across multiple projects using a unique parameter to differentiate models. ```python ta.Fit_Global(multi_project = ta_list, unique_parameter = 'pump_power') ta.Fit_Global(multi_project = ta_list, unique_parameter = 'pump_power', weights = [1/power1,1/power2]) ``` -------------------------------- ### self.Compare_at_wave() Source: https://kimopack.readthedocs.io/en/latest/Comparing.html Plots multiple kinetics into the same figure at one or multiple given wavelengths, supporting normalization and scaling. ```APIDOC ## self.Compare_at_wave() ### Description Plots multiple kinetics into the same figure at one or multiple given wavelengths (rel_wave). It allows for normalization and scaling, with the spectral window width defined by the width parameter or ta.wavelength_bin. ### Usage Useful for comparing kinetics across different quencher concentrations, pump powers, or fits. ``` -------------------------------- ### Download workflow notebooks Source: https://kimopack.readthedocs.io/en/latest/_sources/Installation.rst.txt One-line commands to download the provided Jupyter notebook workflows. ```text ipython -c "import KiMoPack; KiMoPack.download_notebooks()" python -c "import KiMoPack; KiMoPack.download_notebooks()" python3 -c "import KiMoPack; KiMoPack.download_notebooks()" ``` -------------------------------- ### Manual DAS Calculation for same_DAS=False Source: https://kimopack.readthedocs.io/en/latest/Fitting.html Iterate through a list of projects to manually update parameters and perform global fitting when shared DAS is disabled. ```python for ta_local in projects_list: local_fitted_parameter=ta.par_fit try: for key in unique_parameter: local_fitted_parameter[key].value=ta_local.par.value except: pass ta_local.par=local_fitted_parameter for key in ta_local.par.keys(): ta_local.par[key].vary=False ta_local.Fit_Global() ta_local.Plot_Fit_output() ``` -------------------------------- ### self.Compare_at_time() Source: https://kimopack.readthedocs.io/en/latest/Comparing.html Plots multiple spectra into the same figure at one or multiple given timepoints, supporting normalization and scaling. ```APIDOC ## self.Compare_at_time() ### Description Plots multiple spectra into the same figure at one or multiple given timepoints (rel_time). It supports normalization and scaling, and can integrate over a time window if ta.time_width_percent is specified. ### Usage This function is useful for comparing spectra across different solvents, quenchers, or fits. It also supports comparing measured spectra against external data loaded into a DataFrame. ``` -------------------------------- ### Define Normalization Window Source: https://kimopack.readthedocs.io/en/latest/_sources/Comparing.rst.txt Specify the time and wavelength range for normalization using a four-element list. ```python [Start time, End time, Start wavelength, End Wavelength] ``` -------------------------------- ### self.Save_project() Source: https://kimopack.readthedocs.io/en/latest/_sources/Saving.rst.txt Saves the current TA project state as an HDF5 file for future reloading. ```APIDOC ## self.Save_project() ### Description Saves the TA project as an HDF5 file, including set parameters, fit results, and raw data. It restores chirp-corrected data upon import. Note: External fit functions (ta.mod) must be re-assigned after reloading. ### Parameters - **filename** (str) - Optional - The name of the file to save. If empty, defaults to the original ASCII filename. - **path** (str) - Optional - The directory path for the saved file. ``` -------------------------------- ### Save/Export Data as ASCII Source: https://kimopack.readthedocs.io/en/latest/Saving.html Exports raw and fit data to text files. Allows configuration of separators, file paths, and specific dataset selection. ```python self.Save_data() ``` -------------------------------- ### self.Save_Powerpoint() Source: https://kimopack.readthedocs.io/en/latest/_sources/Saving.rst.txt Generates a PowerPoint presentation containing slides for RAW plots and fit outputs. ```APIDOC ## self.Save_Powerpoint() ### Description Calls 'Plot_RAW' and 'Plot_fit_output' to save plots as 'png' and compiles them into a PowerPoint file with separate slides for RAW and Fit data. If 'savetype' includes 'png', 'svg', or 'pdf', a summary file is also created. ### Parameters - Parameters are identical to the plotting functions. - **save_RAW** (bool) - Optional - Switch for faster processing of RAW plots. - **save_Fit** (bool) - Optional - Switch for faster processing of Fit plots. ``` -------------------------------- ### Parameter Naming Convention Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt The regex pattern required for naming parameters. ```regex [a-z_][a-z0-9_]* ``` -------------------------------- ### Recalculate DAS for Multiple Projects Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Updates parameter values across a list of projects and triggers a global fit for each. ```python for ta_local in projects_list: local_fitted_parameter=ta.par_fit try: for key in unique_parameter: local_fitted_parameter[key].value=ta_local.par.value except: pass ta_local.par=local_fitted_parameter for key in ta_local.par.keys(): ta_local.par[key].vary=False ta_local.Fit_Global() ta_local.Plot_Fit_output() ``` -------------------------------- ### Perform Global Fitting Source: https://kimopack.readthedocs.io/en/latest/Fitting.html Execute global fitting across multiple projects with optional weighting or shared DAS. ```python ta.Fit_Global(multi_project = ta_list, unique_parameter = ‘pump_power’) ta.Fit_Global(multi_project = ta_list, unique_parameter = ‘pump_power’, weights = [1/power1,1/power2]) ``` ```python ta.Fit_Global(multi_project=[ta1],same_DAS=True) ``` -------------------------------- ### Save Plots as Powerpoint Source: https://kimopack.readthedocs.io/en/latest/Saving.html Generates a PowerPoint presentation with slides for raw and fit plots. Supports additional switches for faster processing. ```python self.Save_Powerpoint() ``` -------------------------------- ### self.Save_Powerpoint() Source: https://kimopack.readthedocs.io/en/latest/Saving.html Convenience function that saves plots as PNGs and creates a PowerPoint presentation. ```APIDOC ## self.Save_Powerpoint() ### Description Convenience function that calls both “Plot_RAW” and if possible “Plot_fit_output” and saves the plots as “png”. It then creates a power point file with one slide for the RAW plots and one slide for the Fits. Additional switches save_RAW and save_Fit allow for faster processing. ``` -------------------------------- ### Trigger Global Fit Source: https://kimopack.readthedocs.io/en/latest/Fitting.html Executes the global fitting process using the current parameter configuration. ```python self.Fit_Global() ``` -------------------------------- ### Iterative Global Fitting Source: https://kimopack.readthedocs.io/en/latest/Fitting.html Refine fit parameters iteratively, useful for chirp optimization. ```python for i in range(5): start_error=ta.re['error'] ta.par=ta.par_fit ta.Fit_Global(fit_chirp=True) if not ta.re['error'] < start_error:break ``` -------------------------------- ### Accessing multi-project results Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Retrieve and plot results from specific projects stored in the multi_projects variable after a global fit. ```python ta.re = ta.multi_projects[1] ta.Plot_fit_output() ``` ```python ta.re = ta.multi_projects[0] ``` -------------------------------- ### self.Plot_fit_output() Source: https://kimopack.readthedocs.io/en/latest/Plotting.html Plots the fit results using data from shaped and cut datasets, including rebinning and temporal restrictions. ```APIDOC ## self.Plot_fit_output() ### Description Plots the fit results using the data contained in the shaped and cut datasets that were used for the fit. This includes all rebinning or temporal restrictions applied to the model. ### Usage `self.Plot_fit_output()` ### Plot Contents - **DAC**: Assigned spectra for each component (DAS for independent exponential decays, SAS for other models). - **Summed Intensity**: Sum of all wavelengths for both data and fit. - **Kinetics**: Plot kinetics for selected wavelengths. - **Spectra**: Plot spectra at selected times. - **Matrix**: Plots measured, modelled, and error matrices (supports 'error_matrix_amplification' scaling factor). - **Concentrations**: Relative concentrations of species as a function of time. ``` -------------------------------- ### Access Multi-Project Results Source: https://kimopack.readthedocs.io/en/latest/Fitting.html Retrieve and plot results from specific projects when using same_DAS=True. ```python ta.re = ta.multi_projects[1] ta.Plot_fit_output() ``` ```python ta.re = ta.multi_projects[0] ``` -------------------------------- ### Resetting shaping parameters Source: https://kimopack.readthedocs.io/en/latest/_sources/Shaping.rst.txt Explicitly reset a parameter to None to clear previous settings, as commenting out a line does not revert to default values. ```python ta.intensity_range = 3e-3 #ta.intensity_range = 3e-3 #no effect ta.intensity_range = None ``` -------------------------------- ### Global fitting with shared DAS Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Perform global fitting while enforcing the same Decay Associated Spectra (DAS) across projects. ```python ta.Fit_Global(multi_project=[ta1],same_DAS=True) ``` -------------------------------- ### Parameter Name Regex Pattern Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Regex pattern used to validate parameter names. ```regex [a-z_][a-z 0-9_]* ``` -------------------------------- ### Resetting Data Parameters Source: https://kimopack.readthedocs.io/en/latest/Shaping.html Explicitly set a parameter to None to revert it, as commenting out a line does not reset the value to its default. ```python ta.intensity_range = 3e-3 #ta.intensity_range = 3e-3 #no effect ta.intensity_range = None ``` -------------------------------- ### Rate Parameter Recognition Logic Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Python logic used to determine if a parameter is interpreted as a rate based on its name. ```python bool(re.match(re.compile(’[k]'̣), parameter_name[:2]) ``` -------------------------------- ### self.Save_data() Source: https://kimopack.readthedocs.io/en/latest/_sources/Saving.rst.txt Exports data to ASCII/text format for use in external plotting programs. ```APIDOC ## self.Save_data() ### Description Exports chirp-corrected data, slices, and fit results to ASCII/text files. Automatically generates a text file containing fit results. ### Parameters - **save_RAW** (bool) - Optional - Selects if RAW datasets are stored. - **save_Fit** (bool) - Optional - Selects if Fit datasets are stored. - **save_slices** (bool) - Optional - Selects if slices defined by ta.rel_wave and ta.rel_time are saved. - **save_binned** (bool) - Optional - Selects if the chirp-corrected and rebinned dataset is saved. - **filename** (str) - Optional - Base filename for exported files. - **path** (str) - Optional - Folder path relative to ta.path. - **sep** (str) - Optional - Separator used for values (default is 'TAP'). ``` -------------------------------- ### Extract and Plot Species Spectra Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Extracts species spectra and subtracts specific contributions before plotting the raw data. ```python #extract the spectra dicten=pf.Species_Spectra(ta) #plot the measured spectrum and substract the #contribution of "1" and "2" ta.Plot_RAW(ds=ta.re['A']-dicten[1]-dicten[2]) ``` -------------------------------- ### Iterative Global Fitting Source: https://kimopack.readthedocs.io/en/latest/_sources/Fitting.rst.txt Refines fit results by iteratively updating parameters and re-running the global fit until the error stops decreasing. ```python for i in range(5): start_error=ta.re['error'] ta.par=ta.par_fit ta.Fit_Global(fit_chirp=True) if not ta.re['error'] < start_error:break ``` -------------------------------- ### Save Plots Source: https://kimopack.readthedocs.io/en/latest/Saving.html Convenience function to save both raw and fit plots. Parameters are passed through to the underlying plotting functions. ```python self.Save_Plots() ``` -------------------------------- ### Manual data filtering Source: https://kimopack.readthedocs.io/en/latest/_sources/Shaping.rst.txt Directly manipulate the dataset matrix to filter out values exceeding a specific threshold. ```python ta.ds (the chirp corrected data) or ta.ds_ori[ta.ds_ori>20]=0 is the classical way to filter ``` -------------------------------- ### self.Save_Plots() Source: https://kimopack.readthedocs.io/en/latest/_sources/Saving.rst.txt A convenience function that triggers both Plot_RAW and Plot_fit_output to save current plots for status capture. ```APIDOC ## self.Save_Plots() ### Description Calls both 'Plot_RAW' and 'Plot_fit_output' (if available) to save the current plots. This is intended for quick exploratory work to capture the current status. ### Parameters - Parameters are identical to the underlying 'Plot_RAW' and 'Plot_fit_output' functions. ``` -------------------------------- ### Scale Data Intensity Source: https://kimopack.readthedocs.io/en/latest/_sources/Comparing.rst.txt Manually adjust the intensity of a dataset by modifying the internal data matrix. Note that this modifies the current object's data, but the original data remains preserved in ta.ds_ori. ```python "ta.ds*=1.1" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.