API Reference#

Luxbeam.luxbeam module#

class Luxbeam.luxbeam.Luxbeam(dmd_ip, inverse=False, timeout=None, jumbo_frame=False)[source]#

Bases: object

This class implements the control protocol of Luxbeam digital micro-mirror device (DMD) controller.

Parameters:
  • dmd_ip (str) – The IP address of the Luxbeam.

  • inverse (bool) – If true, display the inverse of the images instead.

  • timeout (None or float) – If specified, this number will be used for setting the timeout of the socket while communicating with the Luxbeam.

  • jumbo_frame (bool) – If true, use jumbo frame (MTU:9000).

property cols#

number of columns on the DMD.

Type:

int

get_dmd_info()[source]#

Get various information about the DMD mounted in the Luxbeam.

Returns:

  • dmd_type (int) –

    The DMD type mounted on the board. See table below for valid values.
    • DMD_TYPE_1080P_A (0): .95 1080p Type A

    • DMD_TYPE_XGA_A (1): .7 XGA Type A

    • DMD_TYPE_XGA_X (3): .55 XGA Type X

    • DMD_TYPE_WUXGA_A (5): .96 WUXGA Type A

    • DMD_TYPE_UNKNOWN (99): Unknown DMD connected. (blocks, cols, etc not valid in this case)

    • DMD_TYPE_NO_DMD_CONNECTED (15): No DMD connected. (blocks, cols, etc not valid in this case)

  • blocks (int) – The number of blocks that the DMD is divided into.

  • cols (int) – The horizontal pixel resolution of the DMD.

  • rows (int) – The vertical pixel resolution for the DMD.

  • rows_pr_block (int) – The number of rows in a block.

get_dmd_mirror_shake()[source]#
get_image_type()[source]#
get_inum_size()[source]#
get_network_settings()[source]#

Get the network settings of the Luxbeam.

Returns:

  • ip_addr (str)

  • subnet (str)

  • gateway (str)

  • dhcp (int) –

    • ENABLE (1): DHCP is enabled.

    • DISABLE (0): DHCP is disabled.

get_sequencer_file_error_log()[source]#
get_sequencer_reg(reg_no)[source]#
get_software_sync()[source]#
load_image(inum, image, delay=None)[source]#

Load an image to memory on the Luxbeam.

Parameters:
  • inum (int) –

  • image (str or numpy.ndarray) –

  • delay (float) –

load_sequence(sequence_file)[source]#

Load an sequence file to the Luxbeam.

Parameters:

sequence_file (str) – The content of the sequence file.

recv_ack()[source]#

Receive the ack message from DMD. If the error_code is not zero, raise LuxbeamError. :raises Luxbeam.luxbeam.LuxbeamError:

recv_packet(use_data_port=False)[source]#

Receive the packet from the Luxbeam.

Returns:

  • rec_id (int)

  • payload (bytes)

property rows#

number of rows on the DMD.

Type:

int

save_settings()[source]#

This function is used to store parameters that are marked <<Permanent>> in nonvolatile memory.

send_packet(rec_id, payload=None, use_data_port=False)[source]#

Send the packet to the Luxbeam.

Parameters:
  • rec_id (int) –

  • payload (bytes) –

  • use_data_port (bool) – Send the packet to the data port (52986) instead. Used for sending the image.

set_dmd_mirror_shake(enable)[source]#
set_factory_defaluts()[source]#

This function will reset parameters back to factory defaults and store these values in nonvolatile memory This will reset the parameters that are marked as <<permanent>> back to its default settings.

set_image_type(image_type)[source]#
set_inum_size(rows)[source]#
set_network_settings(ip_addr=None, subnet=None, gateway=None, dhcp=0)[source]#

Set the network settings of the Luxbeam.

Parameters:
  • ip_addr (str) –

  • subnet (str) –

  • gateway (str) –

  • dhcp (int) –

    • ENABLE (1): DHCP is enabled.

    • DISABLE (0): DHCP is disabled.

set_safe_shutdown()[source]#

This function will make the Luxbeam go into a mode where it is safe to remove the power-supply.

This mode should always be entered before powering-off the product. Note that after entering this mode, the product will no longer respond to any communication and must be power off and on to function normally again. The LEDs will alternately flash red and yellow when in shutdown-mode.

set_sequencer_reg(reg_no, reg_val)[source]#
set_sequencer_state(seq_cmd, enable)[source]#

This function is used to manipulate the status of the sequencer in Luxbeam.

Parameters:
  • seq_cmd (int) –

    Command to send. See table below for valid commands.

    SEQ_CMD_RUN (1): When enabled, the sequencer will start running from its current position. When disabled, the sequencer will stop at its current position. SEQ_CMD_RESET (2): When enabled, the sequencer will enter its <<reset>>-state. When disabled, the sequencer will be taken out of its <<reset>>-state.

  • enable (int) – ENABLE (1) or DISABLE (2)

Raises:

Luxbeam.luxbeam.LuxbeamError – If an invalid seq_cmd is sent in, a LuxbeamError with error number 10006 (Invalid sequence command) will be raised.

set_software_sync(level)[source]#
exception Luxbeam.luxbeam.LuxbeamError(error_code)[source]#

Bases: Exception

Luxbeam.sequencer module#

class Luxbeam.sequencer.LuxbeamSequencer[source]#

Bases: object

This class is used to compose the Luxbeam sequencer code.

add(var_a, value_or_var_b, wait_for=1)[source]#
add_line(command, parameters)[source]#

Add one line of instruction to the sequence.

This can be used to add insturctions that hasn’t been implemented.

Parameters:
  • command (str) –

  • parameters (list) –

assign_var(value=0, var=None, wait_for=1)[source]#
Parameters:
  • value (int) – Value of the variable.

  • var (None or str) – Name of the variable. If not specify, an autogenerated name would be assigned.

  • wait_for (int) –

Returns:

var_luxbeam

Return type:

Luxbeam.luxbeam.LuxbeamSequencerVariable

assign_var_reg(regno=0, var=None, wait_for=1)[source]#
Parameters:
  • regno (int) –

  • var (None or str) – Name of the variable. If not specify, an autogenerated name would be assigned.

  • wait_for (int) –

Returns:

var_luxbeam

Return type:

Luxbeam.luxbeam.LuxbeamSequencerVariable

clear()[source]#
dumps()[source]#

Generate the sequencer code.

Returns:

sequencer_code

Return type:

Generated sequencer code.

jump(label, wait_for=1)[source]#
jump_if(var_a, operator, var_b, label, wait_for=1)[source]#
jump_loop_iter()[source]#
label(label, wait_for=1)[source]#
load_global(inum, wait_for=400)[source]#
range_loop_iter(start, end=None, step=1)[source]#
Parameters:
  • start (int or Luxbeam.luxbeam.LuxbeamSequencerVariable) –

  • end (int or Luxbeam.luxbeam.LuxbeamSequencerVariable) –

  • step (int or Luxbeam.luxbeam.LuxbeamSequencerVariable) –

reset_global(wait_for=1)[source]#
Parameters:

wait_for (int) –

trig(mode, source, timeout)[source]#
Parameters:
  • mode (int) –

  • source (int) –

  • timeout (int) –

wait(value=1)[source]#
class Luxbeam.sequencer.LuxbeamSequencerJumpLoopIterator(parent: LuxbeamSequencer)[source]#

Bases: object

class Luxbeam.sequencer.LuxbeamSequencerRangeLoopIterator(parent: LuxbeamSequencer, start=0, end=1, step=1)[source]#

Bases: object

class Luxbeam.sequencer.LuxbeamSequencerVariable(parent: LuxbeamSequencer, var)[source]#

Bases: object

Enums#

DISABLE = 0
ENABLE = 1

SEQ_CMD_RUN = 1
SEQ_CMD_RESET = 2

TRIG_MODE_POSITIVE_EDGE = 0
TRIG_MODE_NEGATIVE_EDGE = 1
TRIG_MODE_HIGH_LEVEL = 2
TRIG_MODE_LOW_LEVEL = 3

TRIG_SOURCE_NONE = 0
TRIG_SOURCE_ELECTRICAL = 1 << 0
TRIG_SOURCE_OPTICAL = 1 << 1
TRIG_SOURCE_INTERNAL = 1 << 2
TRIG_SOURCE_SOFTWARE = 1 << 3
TRIG_SOURCE_DELAYED = 1 << 4

DMD_TYPE_1080P_A = 0
DMD_TYPE_XGA_A = 1
DMD_TYPE_XGA_X = 3
DMD_TYPE_WUXGA_A = 5
DMD_TYPE_UNKNOWN = 99
DMD_TYPE_NO_DMD_CONNECTED = 15