zooc.data.offset_data

Offset data contains the Z-offset calibration data.

class zooc.data.offset_data.OffsetData(offset_temps=<factory>)

Bases: object

Collection of Z-offsets (OffsetTemp) at certain temperatures with interpolation functions.

Parameters:

offset_temps (list[OffsetTemp]) – List of OffsetTemp instances containing bed and extruder temperatures and z-offsets measurement.

static build_text(list_lines)

Create OffsetData from the list of key-value pairs.

Parameters:

list_lines (list[str]) – List of key-value pairs: bed_temp=<bed_temp>, extruder_temp=<extruder_temp>, z_offset=<z_offset>.

Returns:

OffsetData parsed from list_lines.

Return type:

OffsetData

calculate_z_offset(temps_ref, temps)

Calculate relative Z-offset to reference point.

Positive value indicates the nozzle should be lifted to keep the distance to bed constant at given temperature.

Parameters:
  • temps_ref (Temps) – Reference temperatures where relative Z-offset is zero.

  • temps (Temps) – Temperatures to calculate the difference to temps_ref.

Returns:

Relative Z-offset from the reference point.

Return type:

float

get_z_ref(temps)

Get the absolute z-offset for the given temperatures.

Parameters:

temps (Temps) – The temperatures.

Returns:

Absolute Z-offset at the temperature <temps>.

Raises:

ValueError – If the z-offset is not defined for the given temperatures.

Return type:

float

is_valid()

Check whether the data is valid.

Returns:

True when valid.

Return type:

bool

to_string()

Convert offset data to key-value multiline string.

See offset_temp.OffsetTemp.to_string()

Returns:

Lines of:

<key_1a>=<value_1a>, <key_1b>=<value_1b>, ...
<key_2a>=<value_2a>, <key_2b>=<value_2b>, ...
...

Return type:

str

property get_interp: SurfaceExtrapolator

Create and get interpolator for the calibration data.

Returns:

Interpolator function.

property list_be: list[tuple[float, float]]

Get the list of bed and extruder temperatures.

Returns:

Bed and extruder temperatures as list.

property list_z: list[float]

Get the list of z-offsets.

Returns:

Entries as a list of z-offsets.