class

class phyphox.BufferMode(value)

Constant used to build URLs to retrieve data.

FULL = 0

FULL Retrieve all data.

LAST = 1

LAST Retrieve only the last measurement (one per buffer).

UPDATE = 2

UPDATE Retrieve all data since the last call.

class phyphox.Logger(adresse, port=8080, protocol='http', no_proxy=False)

Phyphox Logger class

Parameters:
  • ip (str) – Device IP address.

  • port (int) – Port number (default: 8080).

  • protocol (str) – Communication protocol (default: ‘http’).

  • no_proxy (bool) – If True, disables proxy usage by setting the environment variable (default: False).

base_url

url to access phone phyphox application

buffer_needed(l_exp=None)

Selects buffers in the Phyphox configuration. if l_exp is None, all buffers are selected. Otherwise, l_exp must be a list of tuples (id, (b_id1, …)), where id is the source index in the configuration data, and b_id is the buffer index in the source list.

Parameters:

l_exp (list) – list of tuple. default value is None

Return bool:

False is something wrong in list

Creates a link to retrieve selected buffers. On the first call, all data are retrieved; on subsequent calls, only data after val_time are retrieved.

Parameters:
channel

channel name

clear_data()

Stop sampling and reset buffer in the Phyphox app.

Returns:

JSON response (True on success).

export_file(filetype=0, filename='data.xls')

Retrieves all recorded data in a single file. File types: 0 for xls 1 zip file included csv with comma separator and decimal point 2 zip file included csv with tabulator separator and decimal point 3 zip file included csv with semicolon separator and decimal point 4 zip file included csv with tabulator separator and decimal comma 5 zip file included csv with semicolon separator and decimal comma

Parameters:
  • filetype (int) – default is 0 for xls

  • filename (str) – file name to save. default is “data.xls”

get_all_buffer_read()

Returns a deep copy of all read buffers.

get_buffer_name(idx: int) str

Returns the name of the buffer at index idx.

Return str:

buffer name

get_config(force_update=False)

Retrieves configuration data for the selected experiment.

get_last_buffer_read()

Returns the last buffer list.

get_meta(force_update=False)

Get meta information from phyphox phone application

Parameters:

force_update (bool) – True retrieve data from mobile phone otherwise use old data.

get_meta_key(key)

Retrieves a key from the JSON metadata.

Parameters:

key (str) – Key to retrieve.

Returns:

Key value if it exists, otherwise None.

get_nb_measure()

Returns the number of measurements for the first buffer.

get_time()

Get phone time reference

init_sensors()

Builds sensor objects using metadata.

legend

legend for each channel

new_data

True when new data is available

overflow

True when new data overflow non read data

print_buffer_name()

Prints available buffers from configuration data.

print_reponse(json_reponse, niveau=0)

Affichage des données json de la structure

print_select_buffer()

Print user selected buffer in config data

read_buffers(stack_data=True, mode_data=BufferMode.UPDATE)

read data for selected buffer and put data in a list of numpy array (private attribute __numpy_tabs) if full data is True all data since experiment begining is retrieve otherwise only data since last call. if stack_data is True data are pushed in a list otherwise only last data are keep in memory

Parameters:
  • stack_data (bool) – True data are pushed in a list otherwise only last data are keep in memory

  • mode_data (BufferMode) – see

Returns:

True if new data are available

send_url(cmd_key)

open standard phyphox URL.

Parameters:

cmd_key (str) – Command to send

Return dict:

A dictionary with the JSON response, or an empty dict if no response.

start()

Sends the start command to the Phyphox app.

Returns:

JSON response (True on success).

stop()

Stop sampling of phyphox phone application

Returns:

JSON response (True on success).

class phyphox.Sensor(metadata: dict | None = None)

Phyphox Sensor class

Parameters:

metadata (dict) – sensor metadata

Refer to the Phyphox documentation for details. .

get(key: (<class 'int'>, <class 'str'>))

extract key in JSON sensor description

Parameters:

key (str, int) – key to extract

Return key:

value if key exist otherwise None

class phyphox.Experiment(metadata: dict | None = None)

Experiment class

Parameters:

metadata (dict) – experiment metadata

Refer to the Phyphox experiment documentation. .

get(key: (<class 'int'>, <class 'str'>))

get key in JSON phyphox config data parameter key: str return key value if key exist otherwise None

get_experiments_struct()

Get information about experiment from phyphox phone application