Subpackages

snom_analysis.lib.data_range_selector module

snom_analysis.lib.data_range_selector.select_data_range(data, channel)[source]
class snom_analysis.lib.data_range_selector.ArraySelector(root, data, channel)[source]

Bases: object

Methods

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

update_scaling_factor()[source]
on_button_press(event)[source]
on_mouse_drag(event)[source]
on_button_release(event)[source]
on_mouse_move(event)[source]
fill_canvas()[source]
on_windowsize_changed(event)[source]
highlight_selection()[source]
invert_selection()[source]
toggle_selection_mode()[source]
get_coordinates()[source]

snom_analysis.lib.edge_detection module

class snom_analysis.lib.edge_detection.EdgeDetection(data)[source]

Bases: object

This 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

create_gui()[source]
calculate_edges(sigma, threshold_low, threshold_high)[source]
accept(event)[source]
exit(event)[source]
update(val)[source]

snom_analysis.lib.file_handling module

snom_analysis.lib.file_handling.find_index(header, filepath, channel)[source]
snom_analysis.lib.file_handling.get_parameter_values(parameters_dict, parameter) list[source]
snom_analysis.lib.file_handling.convert_header_to_dict(filepath, separator=':', header_indicator='#', tags_list: list = None) dict[source]

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_smallest_difference(value1, value2)[source]
snom_analysis.lib.phase_analysis.get_difference(value1, value2)[source]
snom_analysis.lib.phase_analysis.get_difference_2(value1, value2)[source]
snom_analysis.lib.phase_analysis.get_profile_difference(profile1: list, profile2: list) list[source]
snom_analysis.lib.phase_analysis.get_profile_difference_2(profile1: list, profile2: list) list[source]
snom_analysis.lib.phase_analysis.get_modeindex_from_linearfunction(slope, pixelsize, wavelength=1600)[source]

snom_analysis.lib.phase_slider module

snom_analysis.lib.phase_slider.get_phase_offset(preview_data)[source]
class snom_analysis.lib.phase_slider.PhaseSlider(preview_data)[source]

Bases: object

Methods

accept

shift_phase

update

accept(event)[source]
update(val)[source]
shift_phase()[source]

snom_analysis.lib.profile module

snom_analysis.lib.profile.horizontal_profile(array)[source]

snom_analysis.lib.profile_selector module

snom_analysis.lib.profile_selector.select_profile(data, channel)[source]
class snom_analysis.lib.profile_selector.CutlineSelector(img_array, channel)[source]

Bases: object

Methods

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

add_widgets()[source]
update_width(val)[source]
on_key_press(event)[source]
on_key_release(event)[source]
on_click(event)[source]
on_release(event)[source]
on_motion(event)[source]
is_near_point(p1, p2)[source]

Check if point p1 is near point p2 within a certain tolerance.

adjust_endpoint(fixed_point, new_point)[source]

Adjust endpoint along the fixed orientation.

clip_point_to_image(x, y)[source]

Ensure point (x, y) is within the image bounds.

clear_cutline()[source]
update_cutline()[source]
draw_perpendicular_lines(x0, y0, x1, y1)[source]
extract_cutline(event)[source]

snom_analysis.lib.realign module

snom_analysis.lib.realign.calculate_squared_mean_deviation(array_1, array_2) float[source]
snom_analysis.lib.realign.calculate_squared_deviation(array_1, array_2) list[source]
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(array_1, array_2)[source]
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

snom_analysis.lib.realign.minimize_drift(data: array, n_tries=5, display=False) array[source]

This function tries to shift subsequent lines of a single measurement to minimize the deviation. The function will return the drift corrected data.

Returns:

the drift corrected data

Return type:

np.array

snom_analysis.lib.rectangle_selector module

snom_analysis.lib.rectangle_selector.select_rectangle(data, channel)[source]
class snom_analysis.lib.rectangle_selector.Rectangle_Selector(data, channel)[source]

Bases: object

Methods

accept

create_plot

create_plot()[source]
accept(value)[source]

snom_analysis.lib.snom_colormaps module