null_classes

Classes

class NullBpod[source]

Bases: object

close() None[source]
send_state_machine(sma: Any) None[source]
run_state_machine(sma: Any) None[source]
register_value(name: str, value: Any) None[source]
manual_override(channel_type: Any, channel_name: Any, channel_number: Any, value: Any) None[source]
class NullStateMachine[source]

Bases: object

add_state(state_name: Any, state_timer: float = 0, state_change_conditions: Any = {}, output_actions: Any = ()) None[source]
set_global_timer(timer_id: Any, timer_duration: Any, on_set_delay: int = 0, channel: Any | None = None, on_message: int = 1, off_message: int = 0, loop_mode: int = 0, loop_intervals: int = 0, send_events: int = 1, oneset_triggers: Any | None = None) None[source]
set_condition(condition_number: Any, condition_channel: Any, channel_value: Any) None[source]
set_global_counter(counter_number: Any, target_event: Any, threshold: Any) None[source]
class NullSoftCodeToBpod[source]

Bases: object

send(idx: int) None[source]
kill() None[source]
class NullTelegramBot[source]

Bases: object

error: str = 'Error connecting to the telegram_bot '
alarm(message: str) None[source]

Sends an alarm message.

Parameters:

message (str) – The alarm message.

class NullScale[source]

Bases: object

error: str = 'Error connecting to the scale '
tare() None[source]

Tares the scale.

calibrate(weight: float) None[source]

Calibrates the scale using a known weight.

Parameters:

weight (float) – The known weight.

get_weight() float[source]

Gets the current weight.

Returns:

The weight reading (default 0.0).

Return type:

float

real_weight_inference() tuple[bool, float][source]

Determines if a sequence of weight measurements represents a stable weight.

Conditions to call it a real weight: - standard deviation of the last 5 measurements is

smaller than 10% of the threshold

Returns:

(True, median_weight) if stable, else (False, 0.0).

Return type:

tuple[bool, float]

class NullTempSensor[source]

Bases: object

error: str = 'Error connecting to the temp_sensor '
start() None[source]

Starts the sensor.

get_temperature() tuple[float, float, str][source]

Gets temperature and humidity.

Returns:

Temperature, humidity, and formatted string.

Return type:

tuple[float, float, str]

class NullMotor[source]

Bases: object

error: str = 'Error connecting to the motor '
open_angle: int = 0
close_angle: int = 0
open() None[source]

Opens the motor/device.

close() None[source]

Closes the motor/device.

class NullSoundDevice[source]

Bases: object

samplerate: int = 44100
error: str = 'Error connecting to the sound_device '
load(load: Any, right: Any) None[source]

Loads sound data.

Parameters:
  • load (Any) – Left channel data or similar.

  • right (Any) – Right channel data.

play() None[source]

Plays the loaded sound.

stop() None[source]

Stops sound playback.

load_wav(file: str) None[source]

Loads a WAV file.

Parameters:

file (str) – Path or name of the WAV file.

class NullCollection[source]

Bases: object

log(date: str, type: str, subject: str, description: str) None[source]

Logs a generic event.

Parameters:
  • date (str) – Date/time string.

  • type (str) – Event type.

  • subject (str) – Subject name.

  • description (str) – Description.

log_temp(date: str, temperature: float, humidity: float) None[source]

Logs temperature and humidity data.

Parameters:
  • date (str) – Date/time string.

  • temperature (float) – Temperature value.

  • humidity (float) – Humidity value.

class NullCamera[source]

Bases: object

area1: list[int] = []
area2: list[int] = []
area3: list[int] = []
area4: list[int] = []
areas: list[list[int]] = []
area1_is_triggered: bool = False
area2_is_triggered: bool = False
area3_is_triggered: bool = False
area4_is_triggered: bool = False
change: bool = False
annotation: str = ''
path_picture: str = ''
error: str = 'Error connecting to the camera '
trial: int = -1
is_recording: bool = False
show_time_info: bool = False
x_position: int = -1
y_position: int = -1
chrono = <village.scripts.time_utils.TimeUtils.Chrono object>
trigger_event = <threading.Event at 0x7f6d09762650: unset>
start_camera() None[source]

Starts the camera.

stop_camera() None[source]

Stops the camera.

start_preview_window() <MagicMock name='mock.QWidget' id='140106287884368'>[source]

Starts the preview window.

Returns:

A QWidget for the preview.

Return type:

QWidget

stop_preview_window() None[source]

Stops the preview window.

start_recording(path_video: str = '', path_csv: str = '') None[source]

Starts recording.

Parameters:
  • path_video (str) – Path for video file.

  • path_csv (str) – Path for CSV data.

stop_recording() None[source]

Stops recording.

print_info_about_config() None[source]

Prints camera configuration info.

pre_process(request) None[source]

Preprocessing callback for frames.

Parameters:

request – The request object.

write_text(text: str) None[source]

Writes text annotation to the frame.

Parameters:

text (str) – The text to write.

areas_corridor_ok() bool[source]

Checks corridor areas status.

Returns:

True if OK.

Return type:

bool

area_1_empty() bool[source]

Checks if area 1 is empty.

Returns:

True if empty.

Return type:

bool

area_2_empty() bool[source]

Checks if area 2 is empty.

Returns:

True if empty.

Return type:

bool

area_3_empty() bool[source]

Checks if area 3 is empty.

Returns:

True if empty.

Return type:

bool

area_4_empty() bool[source]

Checks if area 4 is empty.

Returns:

True if empty.

Return type:

bool

take_picture() None[source]

Takes a picture.