diff --git a/docs/qudi_hira_analysis/analysis_logic.html b/docs/qudi_hira_analysis/analysis_logic.html index 0364489..7714016 100644 --- a/docs/qudi_hira_analysis/analysis_logic.html +++ b/docs/qudi_hira_analysis/analysis_logic.html @@ -537,12 +537,7 @@
qudi_hira_analysis.analysis_logic
-def analyse_mean(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Calculate the mean of the signal window.
-laser_data
signal_start
signal_end
bin_width
Mean of the signal window and measurement error
@staticmethod
-def analyze_mean(
- laser_data: np.ndarray,
- signal_start: float = 100e-9,
- signal_end: float = 300e-9,
- bin_width: float = 1e-9
-) -> Tuple[np.ndarray, np.ndarray]:
- """
- Calculate the mean of the signal window.
-
- Args:
- laser_data: 2D array of laser data
- signal_start: start of the signal window in seconds
- signal_end: end of the signal window in seconds
- bin_width: width of a bin in seconds
-
- Returns:
- Mean of the signal window and measurement error
- """
- # Get number of lasers
- num_of_lasers = laser_data.shape[0]
-
- if not isinstance(bin_width, float):
- return np.zeros(num_of_lasers), np.zeros(num_of_lasers)
-
- # Convert the times in seconds to bins (i.e. array indices)
- signal_start_bin = round(signal_start / bin_width)
- signal_end_bin = round(signal_end / bin_width)
-
- # initialize data arrays for signal and measurement error
- signal_data = np.empty(num_of_lasers, dtype=float)
- error_data = np.empty(num_of_lasers, dtype=float)
-
- # loop over all laser pulses and analyze them
- for ii, laser_arr in enumerate(laser_data):
- # calculate the mean of the data in the signal window
- signal = laser_arr[signal_start_bin:signal_end_bin].mean()
- signal_sum = laser_arr[signal_start_bin:signal_end_bin].sum()
- signal_error = np.sqrt(signal_sum) / (signal_end_bin - signal_start_bin)
-
- # Avoid numpy C type variables overflow and NaN values
- if signal < 0 or signal != signal:
- signal_data[ii] = 0.0
- error_data[ii] = 0.0
- else:
- signal_data[ii] = signal
- error_data[ii] = signal_error
-
- return signal_data, error_data
-
-def analyse_mean_norm(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, norm_start: float = 1e-06, norm_end=2e-06, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Divides the mean of the signal window from the mean of the reference window.
-laser_data
signal_start
signal_end
norm_start
norm_end
bin_width
Normalized mean of the signal window and measurement error
@staticmethod
-def analyze_mean_norm(
- laser_data: np.ndarray,
- signal_start: float = 100e-9,
- signal_end: float = 300e-9,
- norm_start: float = 1000e-9,
- norm_end=2000e-9,
- bin_width: float = 1e-9
-) -> Tuple[np.ndarray, np.ndarray]:
- """
- Divides the mean of the signal window from the mean of the reference window.
-
- Args:
- laser_data: 2D array of laser data
- signal_start: start of the signal window in seconds
- signal_end: end of the signal window in seconds
- norm_start: start of the reference window in seconds
- norm_end: end of the reference window in seconds
- bin_width: width of a bin in seconds
-
- Returns:
- Normalized mean of the signal window and measurement error
- """
- # Get number of lasers
- num_of_lasers = laser_data.shape[0]
-
- if not isinstance(bin_width, float):
- return np.zeros(num_of_lasers), np.zeros(num_of_lasers)
-
- # Convert the times in seconds to bins (i.e. array indices)
- signal_start_bin = round(signal_start / bin_width)
- signal_end_bin = round(signal_end / bin_width)
- norm_start_bin = round(norm_start / bin_width)
- norm_end_bin = round(norm_end / bin_width)
-
- # initialize data arrays for signal and measurement error
- signal_data = np.empty(num_of_lasers, dtype=float)
- error_data = np.empty(num_of_lasers, dtype=float)
-
- # loop over all laser pulses and analyze them
- for ii, laser_arr in enumerate(laser_data):
- # calculate the sum and mean of the data in the normalization window
- tmp_data = laser_arr[norm_start_bin:norm_end_bin]
- reference_sum = np.sum(tmp_data)
- reference_mean = (reference_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- # calculate the sum and mean of the data in the signal window
- tmp_data = laser_arr[signal_start_bin:signal_end_bin]
- signal_sum = np.sum(tmp_data)
- signal_mean = (signal_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- # Calculate normalized signal while avoiding division by zero
- if reference_mean > 0 and signal_mean >= 0:
- signal_data[ii] = signal_mean / reference_mean
- else:
- signal_data[ii] = 0.0
-
- # Calculate measurement error while avoiding division by zero
- if reference_sum > 0 and signal_sum > 0:
- # calculate with respect to gaussian error 'evolution'
- error_data[ii] = signal_data[ii] * np.sqrt(1 / signal_sum + 1 / reference_sum)
- else:
- error_data[ii] = 0.0
-
- return signal_data, error_data
-
-def analyse_mean_reference(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, norm_start: float = 1e-06, norm_end: float = 2e-06, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Subtracts the mean of the signal window from the mean of the reference window.
-laser_data
signal_start
signal_end
norm_start
norm_end
bin_width
Referenced mean of the signal window and measurement error
@staticmethod
-def analyze_mean_reference(
- laser_data: np.ndarray,
- signal_start: float = 100e-9,
- signal_end: float = 300e-9,
- norm_start: float = 1000e-9,
- norm_end: float = 2000e-9,
- bin_width: float = 1e-9) -> Tuple[np.ndarray, np.ndarray]:
- """
- Subtracts the mean of the signal window from the mean of the reference window.
-
- Args:
- laser_data: 2D array of laser data
- signal_start: start of the signal window in seconds
- signal_end: end of the signal window in seconds
- norm_start: start of the reference window in seconds
- norm_end: end of the reference window in seconds
- bin_width: width of a bin in seconds
-
- Returns:
- Referenced mean of the signal window and measurement error
- """
- # Get number of lasers
- num_of_lasers = laser_data.shape[0]
-
- if not isinstance(bin_width, float):
- return np.zeros(num_of_lasers), np.zeros(num_of_lasers)
-
- # Convert the times in seconds to bins (i.e. array indices)
- signal_start_bin = round(signal_start / bin_width)
- signal_end_bin = round(signal_end / bin_width)
- norm_start_bin = round(norm_start / bin_width)
- norm_end_bin = round(norm_end / bin_width)
-
- # initialize data arrays for signal and measurement error
- signal_data = np.empty(num_of_lasers, dtype=float)
- error_data = np.empty(num_of_lasers, dtype=float)
-
- # loop over all laser pulses and analyze them
- for ii, laser_arr in enumerate(laser_data):
- # calculate the sum and mean of the data in the normalization window
- tmp_data = laser_arr[norm_start_bin:norm_end_bin]
- reference_sum = np.sum(tmp_data)
- reference_mean = (reference_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- # calculate the sum and mean of the data in the signal window
- tmp_data = laser_arr[signal_start_bin:signal_end_bin]
- signal_sum = np.sum(tmp_data)
- signal_mean = (signal_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- signal_data[ii] = signal_mean - reference_mean
-
- # calculate with respect to gaussian error 'evolution'
- error_data[ii] = signal_data[ii] * np.sqrt(1 / abs(signal_sum) + 1 / abs(reference_sum))
-
- return signal_data, error_data
-
def analyze_mean(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
AnalysisLogic
analyse_mean
analyse_mean_norm
analyse_mean_reference
analyze_mean
analyze_mean_norm
analyze_mean_reference
qudi_hira_analysis.data_handler
qudi_hira_analysis.data_handler
qudi_hira_analysis.data_handler
Handles automated data searching and extraction into dataclasses.
-data_folder: Path to the data folder. -figure_folder: Path to the figure folder. -measurement_folder: Path to the measurement folder.
+data_folder
figure_folder
measurement_folder
Create an instance of the DataHandler class:
>>> dh = DataHandler(
@@ -413,7 +419,7 @@ Examples
"""
Handles automated data searching and extraction into dataclasses.
- Parameters:
+ Args:
data_folder: Path to the data folder.
figure_folder: Path to the figure folder.
measurement_folder: Path to the measurement folder.
@@ -647,7 +653,7 @@ Examples
extension: str = ".dat"
) -> dict[str: MeasurementDataclass]:
"""
- Lazy load all measurements of a given type into a dictionary of dataclasses.
+ Lazy-load all measurements of a given type into a dictionary of dataclasses.
Args:
measurement_str: The name of the measurement type to load e.g. t1, t2, confocal etc.
@@ -658,12 +664,13 @@ Examples
extension: The file extension of the measurement files (default: .dat).
Returns:
- dict: A dictionary of dataclasses containing the measurement data.
+ dict: A dictionary where keys are the measurement timestamps and values are dataclasses containing the
+ measurement data.
Examples:
`dh` is an instance of the `DataHandler` class.
- Load all T1 measurements:
+ Load all ODMR measurements:
>>> dh.load_measurements(measurement_str="ODMR", pulsed=True)
@@ -729,7 +736,7 @@ Methods
def load_measurements(self, measurement_str: str, qudi: bool = True, pulsed: bool = False, extension: str = '.dat') ‑> dict[slice(, MeasurementDataclass'>, None)]
Lazy load all measurements of a given type into a dictionary of dataclasses.
+Lazy-load all measurements of a given type into a dictionary of dataclasses.
measurement_str
dict
dh
is an instance of the DataHandler
class.
Load all T1 measurements:
+Load all ODMR measurements:
>>> dh.load_measurements(measurement_str="ODMR", pulsed=True)
Load all confocal data:
@@ -774,7 +782,7 @@AnalysisLogic
:
analyse_mean
analyse_mean_norm
analyse_mean_reference
analyze_mean
analyze_mean_norm
analyze_mean_reference
-def analyse_mean(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Calculate the mean of the signal window.
-laser_data
signal_start
signal_end
bin_width
Mean of the signal window and measurement error
@staticmethod
-def analyze_mean(
- laser_data: np.ndarray,
- signal_start: float = 100e-9,
- signal_end: float = 300e-9,
- bin_width: float = 1e-9
-) -> Tuple[np.ndarray, np.ndarray]:
- """
- Calculate the mean of the signal window.
-
- Args:
- laser_data: 2D array of laser data
- signal_start: start of the signal window in seconds
- signal_end: end of the signal window in seconds
- bin_width: width of a bin in seconds
-
- Returns:
- Mean of the signal window and measurement error
- """
- # Get number of lasers
- num_of_lasers = laser_data.shape[0]
-
- if not isinstance(bin_width, float):
- return np.zeros(num_of_lasers), np.zeros(num_of_lasers)
-
- # Convert the times in seconds to bins (i.e. array indices)
- signal_start_bin = round(signal_start / bin_width)
- signal_end_bin = round(signal_end / bin_width)
-
- # initialize data arrays for signal and measurement error
- signal_data = np.empty(num_of_lasers, dtype=float)
- error_data = np.empty(num_of_lasers, dtype=float)
-
- # loop over all laser pulses and analyze them
- for ii, laser_arr in enumerate(laser_data):
- # calculate the mean of the data in the signal window
- signal = laser_arr[signal_start_bin:signal_end_bin].mean()
- signal_sum = laser_arr[signal_start_bin:signal_end_bin].sum()
- signal_error = np.sqrt(signal_sum) / (signal_end_bin - signal_start_bin)
-
- # Avoid numpy C type variables overflow and NaN values
- if signal < 0 or signal != signal:
- signal_data[ii] = 0.0
- error_data[ii] = 0.0
- else:
- signal_data[ii] = signal
- error_data[ii] = signal_error
-
- return signal_data, error_data
-
-def analyse_mean_norm(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, norm_start: float = 1e-06, norm_end=2e-06, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Divides the mean of the signal window from the mean of the reference window.
-laser_data
signal_start
signal_end
norm_start
norm_end
bin_width
Normalized mean of the signal window and measurement error
@staticmethod
-def analyze_mean_norm(
- laser_data: np.ndarray,
- signal_start: float = 100e-9,
- signal_end: float = 300e-9,
- norm_start: float = 1000e-9,
- norm_end=2000e-9,
- bin_width: float = 1e-9
-) -> Tuple[np.ndarray, np.ndarray]:
- """
- Divides the mean of the signal window from the mean of the reference window.
-
- Args:
- laser_data: 2D array of laser data
- signal_start: start of the signal window in seconds
- signal_end: end of the signal window in seconds
- norm_start: start of the reference window in seconds
- norm_end: end of the reference window in seconds
- bin_width: width of a bin in seconds
-
- Returns:
- Normalized mean of the signal window and measurement error
- """
- # Get number of lasers
- num_of_lasers = laser_data.shape[0]
-
- if not isinstance(bin_width, float):
- return np.zeros(num_of_lasers), np.zeros(num_of_lasers)
-
- # Convert the times in seconds to bins (i.e. array indices)
- signal_start_bin = round(signal_start / bin_width)
- signal_end_bin = round(signal_end / bin_width)
- norm_start_bin = round(norm_start / bin_width)
- norm_end_bin = round(norm_end / bin_width)
-
- # initialize data arrays for signal and measurement error
- signal_data = np.empty(num_of_lasers, dtype=float)
- error_data = np.empty(num_of_lasers, dtype=float)
-
- # loop over all laser pulses and analyze them
- for ii, laser_arr in enumerate(laser_data):
- # calculate the sum and mean of the data in the normalization window
- tmp_data = laser_arr[norm_start_bin:norm_end_bin]
- reference_sum = np.sum(tmp_data)
- reference_mean = (reference_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- # calculate the sum and mean of the data in the signal window
- tmp_data = laser_arr[signal_start_bin:signal_end_bin]
- signal_sum = np.sum(tmp_data)
- signal_mean = (signal_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- # Calculate normalized signal while avoiding division by zero
- if reference_mean > 0 and signal_mean >= 0:
- signal_data[ii] = signal_mean / reference_mean
- else:
- signal_data[ii] = 0.0
-
- # Calculate measurement error while avoiding division by zero
- if reference_sum > 0 and signal_sum > 0:
- # calculate with respect to gaussian error 'evolution'
- error_data[ii] = signal_data[ii] * np.sqrt(1 / signal_sum + 1 / reference_sum)
- else:
- error_data[ii] = 0.0
-
- return signal_data, error_data
-
-def analyse_mean_reference(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, norm_start: float = 1e-06, norm_end: float = 2e-06, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
-
Subtracts the mean of the signal window from the mean of the reference window.
-laser_data
signal_start
signal_end
norm_start
norm_end
bin_width
Referenced mean of the signal window and measurement error
@staticmethod
-def analyze_mean_reference(
- laser_data: np.ndarray,
- signal_start: float = 100e-9,
- signal_end: float = 300e-9,
- norm_start: float = 1000e-9,
- norm_end: float = 2000e-9,
- bin_width: float = 1e-9) -> Tuple[np.ndarray, np.ndarray]:
- """
- Subtracts the mean of the signal window from the mean of the reference window.
-
- Args:
- laser_data: 2D array of laser data
- signal_start: start of the signal window in seconds
- signal_end: end of the signal window in seconds
- norm_start: start of the reference window in seconds
- norm_end: end of the reference window in seconds
- bin_width: width of a bin in seconds
-
- Returns:
- Referenced mean of the signal window and measurement error
- """
- # Get number of lasers
- num_of_lasers = laser_data.shape[0]
-
- if not isinstance(bin_width, float):
- return np.zeros(num_of_lasers), np.zeros(num_of_lasers)
-
- # Convert the times in seconds to bins (i.e. array indices)
- signal_start_bin = round(signal_start / bin_width)
- signal_end_bin = round(signal_end / bin_width)
- norm_start_bin = round(norm_start / bin_width)
- norm_end_bin = round(norm_end / bin_width)
-
- # initialize data arrays for signal and measurement error
- signal_data = np.empty(num_of_lasers, dtype=float)
- error_data = np.empty(num_of_lasers, dtype=float)
-
- # loop over all laser pulses and analyze them
- for ii, laser_arr in enumerate(laser_data):
- # calculate the sum and mean of the data in the normalization window
- tmp_data = laser_arr[norm_start_bin:norm_end_bin]
- reference_sum = np.sum(tmp_data)
- reference_mean = (reference_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- # calculate the sum and mean of the data in the signal window
- tmp_data = laser_arr[signal_start_bin:signal_end_bin]
- signal_sum = np.sum(tmp_data)
- signal_mean = (signal_sum / len(tmp_data)) if len(tmp_data) != 0 else 0.0
-
- signal_data[ii] = signal_mean - reference_mean
-
- # calculate with respect to gaussian error 'evolution'
- error_data[ii] = signal_data[ii] * np.sqrt(1 / abs(signal_sum) + 1 / abs(reference_sum))
-
- return signal_data, error_data
-
def analyze_mean(laser_data: np.ndarray, signal_start: float = 1e-07, signal_end: float = 3e-07, bin_width: float = 1e-09) ‑> Tuple[numpy.ndarray, numpy.ndarray]
Handles automated data searching and extraction into dataclasses.
-data_folder: Path to the data folder. -figure_folder: Path to the figure folder. -measurement_folder: Path to the measurement folder.
+data_folder
figure_folder
measurement_folder
Create an instance of the DataHandler class:
>>> dh = DataHandler(
@@ -2171,7 +1921,7 @@ Examples
"""
Handles automated data searching and extraction into dataclasses.
- Parameters:
+ Args:
data_folder: Path to the data folder.
figure_folder: Path to the figure folder.
measurement_folder: Path to the measurement folder.
@@ -2405,7 +2155,7 @@ Examples
extension: str = ".dat"
) -> dict[str: MeasurementDataclass]:
"""
- Lazy load all measurements of a given type into a dictionary of dataclasses.
+ Lazy-load all measurements of a given type into a dictionary of dataclasses.
Args:
measurement_str: The name of the measurement type to load e.g. t1, t2, confocal etc.
@@ -2416,12 +2166,13 @@ Examples
extension: The file extension of the measurement files (default: .dat).
Returns:
- dict: A dictionary of dataclasses containing the measurement data.
+ dict: A dictionary where keys are the measurement timestamps and values are dataclasses containing the
+ measurement data.
Examples:
`dh` is an instance of the `DataHandler` class.
- Load all T1 measurements:
+ Load all ODMR measurements:
>>> dh.load_measurements(measurement_str="ODMR", pulsed=True)
@@ -2487,7 +2238,7 @@ Methods
def load_measurements(self, measurement_str: str, qudi: bool = True, pulsed: bool = False, extension: str = '.dat') ‑> dict[slice(, MeasurementDataclass'>, None)]
Lazy load all measurements of a given type into a dictionary of dataclasses.
+Lazy-load all measurements of a given type into a dictionary of dataclasses.
measurement_str
dict
dh
is an instance of the DataHandler
class.
Load all T1 measurements:
+Load all ODMR measurements:
>>> dh.load_measurements(measurement_str="ODMR", pulsed=True)
Load all confocal data:
@@ -2532,7 +2284,7 @@AnalysisLogic
:
analyse_mean
analyse_mean_norm
analyse_mean_reference
analyze_mean
analyze_mean_norm
analyze_mean_reference
AnalysisLogic
analyse_mean
analyse_mean_norm
analyse_mean_reference
analyze_mean
analyze_mean_norm
analyze_mean_reference