als.model package

Submodules

als.model.base module

Provide base application data types

class als.model.base.Image(data)[source]

Bases: object

Represents an image, our basic processing object.

Image data is a numpy array. Array’s data type is unspecified for now but we’d surely benefit from enforcing one (float32 for example) as it will ease the development of any later processing code

We also store the bayer pattern the image was shot with, if applicable.

If image is from a sensor without a bayer array, the bayer pattern must be None.

property bayer_pattern

Retrieves the bayer pattern the image was shot with, if applicable.

Returns

the bayer pattern or None

Return type

str

clone()[source]

Clone an image

Returns

an image with global copied data

Return type

Image

property data

Retrieves image data

Returns

image data

Return type

numpy.ndarray

property destination

Retrieves image destination

Returns

the destination

Return type

str

property dimensions

Retrieves image dimensions as a tuple.

This is basically the underlying array’s shape tuple, minus the color axis if image is color

Returns

the image dimensions

Return type

tuple

property height

Retrieves image height

Returns

image height in pixels

Return type

int

is_bw()[source]

Tells if image is black and white

Returns

True if no color info is stored in data array, False otherwise

Return type

bool

is_color()[source]

Tells if the image has color information

image has color information if its data array has more than 2 dimensions

Returns

True if the image has color information, False otherwise

Return type

bool

is_same_shape_as(other)[source]

Is this image’s shape equal to another’s ?

Parameters

other (Image) – other image to compare shape with

Returns

True if shapes are equal, False otherwise

Return type

bool

needs_debayering()[source]

Tells if image needs debayering

Returns

True if a bayer pattern is known and data does not have 3 dimensions

property origin

retrieves info on image origin.

If Image has been read from a disk file, origin contains the file path

Returns

origin representation

Return type

str

set_color_axis_as(wanted_axis)[source]

Reorganise internal data array so color information is on a specified axis

Parameters

wanted_axis – The 0-based number of axis we want color info to be

Image data is modified in place

property width

Retrieves image width

Returns

image width in pixels

Return type

int

class als.model.base.Session(status: int = 0)[source]

Bases: PyQt5.QtCore.QObject

Represents an ALS session

property is_paused

Is session paused ?

Returns

True if session is paused, False otherwise

Return type

bool

property is_running

Is session running ?

Returns

True if session is running, False otherwise

Return type

bool

property is_stopped

Is session stopped ?

Returns

True if session is stopped, False otherwise

Return type

bool

paused = 2
running = 1
set_status(status: int)[source]

Sets session status

Parameters

status (int) – the status to set

status_changed_signal

Qt signal to emit when status changes

stopped = 0

als.model.data module

Provides base application data

class als.model.data.DynamicData[source]

Bases: object

Holds and maintain application dynamic data and notify observers on significant changes

class als.model.data.HistogramContainer[source]

Bases: object

Holds histogram data for an image (color or b&w)

also holds the global maximum among all held histograms and a way to get the number of bins

add_histogram(histogram: numpy.ndarray)[source]

Add an histogram

Parameters

histogram (numpy.ndarray) – the histogram to add

Returns

property bin_count

Get the bin count, that is the length of any stored histogram. We check the first one if exists

Returns

the number of bins used to compute the stored histograms.

Return type

int

get_histograms() → List[numpy.ndarray][source]

Gets the histograms

Returns

the histograms

Return type

List[numpy.ndarray]

property global_maximum

Gets the global maximum among all histograms

Returns

the global maximum among all histograms

Return type

int

als.model.params module

Holds types used for processing parameters

class als.model.params.ListParameter(name: str, description: str, default: Any, choices: list)[source]

Bases: als.model.params.ProcessingParameter

represents a list of choices of type text

class als.model.params.ProcessingParameter(name: str, description: str, default: Any)[source]

Bases: object

Base class for all processing parameters

is_default()[source]

Is this param’s value equal to its default ?

Returns

True if this param’s value is equal to its default value, False otherwise

Return type

bool

reset()[source]

Reset parameter value to parameter default

class als.model.params.RangeParameter(name: str, description: str, default: Any, minimum: int, maximum: int)[source]

Bases: als.model.params.ProcessingParameter

Represents a parameter of type range

class als.model.params.SwitchParameter(name: str, description: str, default: Any)[source]

Bases: als.model.params.ProcessingParameter

Represents an ON / OFF switch

Module contents

Provides all needed application types