Subpackages
snom_analysis.lib.data_range_selector module
- class snom_analysis.lib.data_range_selector.ArraySelector(root, data, channel)[source]
Bases:
objectMethods
fill_canvas
get_coordinates
highlight_selection
invert_selection
on_button_press
on_button_release
on_mouse_drag
on_mouse_move
on_windowsize_changed
toggle_selection_mode
update_scaling_factor
snom_analysis.lib.edge_detection module
- class snom_analysis.lib.edge_detection.EdgeDetection(data)[source]
Bases:
objectThis class creates a GUI to adjust the parameters for the edge detection algorithm. The user can adjust the sigma value, the low and high threshold for the edge detection. The user can accept the values or exit the GUI. Uppon accepting the values the GUI is closed and the values are saved to the class instance variables.
Methods
accept
calculate_edges
create_gui
exit
update
snom_analysis.lib.file_handling module
snom_analysis.lib.phase_analysis module
- snom_analysis.lib.phase_analysis.flatten_phase_profile(profile: list, phase_orientation: int = 1) list[source]
flattened_profile = [] previous_element = profile[0] offset = 0 for element in profile:
- if (phase_orientation == 1) and (element - previous_element < -np.pi):
offset += 2*np.pi # print(‘increased offset’)
- elif (phase_orientation == -1) and (element - previous_element > np.pi):
offset -= 2*np.pi # print(‘reduced offset’)
flattened_profile.append(element + offset) previous_element = element
return flattened_profile
- snom_analysis.lib.phase_analysis.get_profile_difference(profile1: list, profile2: list) list[source]
snom_analysis.lib.phase_slider module
snom_analysis.lib.profile module
snom_analysis.lib.profile_selector module
- class snom_analysis.lib.profile_selector.CutlineSelector(img_array, channel)[source]
Bases:
objectMethods
adjust_endpoint(fixed_point, new_point)Adjust endpoint along the fixed orientation.
clip_point_to_image(x, y)Ensure point (x, y) is within the image bounds.
is_near_point(p1, p2)Check if point p1 is near point p2 within a certain tolerance.
add_widgets
clear_cutline
draw_perpendicular_lines
extract_cutline
on_click
on_key_press
on_key_release
on_motion
on_release
update_cutline
update_width
snom_analysis.lib.realign module
- snom_analysis.lib.realign.shift_array_2d_by_index(array_1, array_2, index) tuple[source]
This function shifts the second 2d array relative to the first. Zeroes will be created on the outside.
- Parameters:
array_1 (np.ndarray) – array1
array_2 (np.ndarray) – array2
index (int) – how much to shift, negative means to the left
- Returns:
shifted arrays
- Return type:
tuple
- snom_analysis.lib.realign.create_mean_array_v2(array_1, array_2, index)[source]
This variant is meant to keep the size of the original array!
- Parameters:
array_1 (_type_) – _description_
array_2 (_type_) – _description_
- Returns:
_description_
- Return type:
_type_
- snom_analysis.lib.realign.minimize_deviation_1d(array_1, array_2, n_tries=5, display=True) int[source]
This function tries to find the optimal shift between two arrays to find the lowest deviation. Best to use leveled data.
- Parameters:
array_1 (np.array) – first array, typically height data
array_2 (np.array) – second array, typically height data
n_tries (int, optional) – the maximum shift expected for optimal overlap, will be applied symmetrically to right and left shift. Defaults to 5.
- Returns:
the optimal shift index, left shift if negative
- Return type:
int
- snom_analysis.lib.realign.minimize_deviation_2d(array_1, array_2, n_tries=5, display=True) int[source]
This function tries to find the optimal shift between two arrays to find the lowest deviation. Best to use leveled data.
- Parameters:
array_1 (np.array) – first array, typically height data
array_2 (np.array) – second array, typically height data
n_tries (int, optional) – the maximum shift expected for optimal overlap, will be applied symmetrically to right and left shift. Defaults to 5.
- Returns:
the optimal shift index, left shift if negative
- Return type:
int