Statistic Notebook for NMR
The following statistics can be created with this notebook:
Statistics of the utilization time (based on “duration”) of each instrument. (per year, month, calendar week, comparison heatmap)
Statistics of the different types of NMR experiment of each instrument.
A chart per instrument is created as html.
Important: The statistics are only generated for a period between 21.09.1677 and 11.04.2262. All other data is excluded from the statistics.If only the “discarded” time or “modified on” time falls within the period, the date is only removed from the statistics for “discarded”/”modified on”.
To run this notebook you need a Jupyter kernel. A kernel is a Python environment that executes the code from your notebook. If no Jupyter kernel is set up yet, you can register one with the following command in the terminal:
python -m ipykernel install --user --name env_name --display-name "YourName"
Imports
Please import all necessary modules first by executing the following section
import sys, os
sys.path.append(os.path.abspath("..")) # for local imports
from datetime import datetime # for begin_date and end_date
from LOGS import LOGS
from LOGS_solutions.GenerateStatistics.StatisticNMR.StatisticsDurationTime import StatisticsDurationTime
from LOGS_solutions.GenerateStatistics.StatisticNMR.StatisticsTypesOfExperiments import StatisticsTypesOfExperiments
Parameters
Please set the parameters as you like.
target_path: The target path, where all statistics should be saved. Default: Within the folder containing the script, a new folder “statistics” is created in which all statistics are saved.
begin_date: Lowest date limit of datastes used for statistics to be created. Has to be a datetime object.
Default: None (no limit)
end_date: Highest date limit of datasets used for statistics to be created. Has to be a datetime object.
Default: None (no limit)
target_path = "./statistics"
begin_date = None # begin_date example: datetime(2024, 1, 1)
end_date = None # end_date example: datetime(2024, 2, 28)
Initialize class objects
Please make sure that the logs.json config file is in the same folder as the other classes and the notebook.
If the formatting of the config file is not clear, refer to the instructions for help: https://docs.logs-python.com/pages/setup.html
The different classes do the following:
StatisticsDurationTime: Generates reports with the statistics for the utilization time of each instrument.
StatisticsTypesOfInstruments: Generates a statistical analysis of the different types of NMR experiments of each instrument.
logs = LOGS()
statistics_duration_time = StatisticsDurationTime(logs, begin_date, end_date, target_path)
statistics_types_experiments = StatisticsTypesOfExperiments(logs, begin_date, end_date, target_path)
Create Statistics
If you would like to create all statistics, simply complete the following section. If you only want to create one specific statistic, please comment out the other.
statistics_duration_time.create_statistic()
statistics_types_experiments.create_statistic()