pymepix package

Subpackages

Submodules

pymepix.main module

Main module for pymepix

class pymepix.main.PostprocessHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]

Bases: RequestHandler

post()[source]
class pymepix.main.RootHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]

Bases: RequestHandler

get()[source]
class pymepix.main.TPXmethodHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]

Bases: RequestHandler

post()[source]
class pymepix.main.TPXpropertyHandler(application: Application, request: HTTPServerRequest, **kwargs: Any)[source]

Bases: RequestHandler

get()[source]
post()[source]
pymepix.main.connect_timepix(args)[source]
pymepix.main.get_path(ref, path)[source]
pymepix.main.is_jsonable(x)[source]
pymepix.main.main()[source]
pymepix.main.make_app()[source]
pymepix.main.post_process(args)[source]
pymepix.main.start_api(args)[source]

pymepix.post_processing module

class pymepix.post_processing.ProgressBar(*_, **__)[source]

Bases: tqdm

gui_bar_fun = None
update_to(progress)[source]
pymepix.post_processing.run_post_processing(input_file_name, output_file, number_processes, timewalk_file, cent_timewalk_file, camera_generation=3, progress_callback=<function updateProgressBar>, clustering_args={}, dbscan_clustering=True, **kwargs)[source]
pymepix.post_processing.updateProgressBar(progress)[source]

pymepix.pymepix_connection module

exception pymepix.pymepix_connection.PollBufferEmpty[source]

Bases: Exception

class pymepix.pymepix_connection.PymepixConnection(pipeline_class=<class 'pymepix.processing.acquisition.PixelPipeline'>)[source]

Bases: object

High level class to work with timepix and perform acquistion

This class performs connection to SPIDR, initilization of timepix and handling of acquisition. Each individual timepix device can be accessed using the square bracket operator.

Parameters:
  • spidr_address (tuple of str and int) – socket style tuple of SPIDR ip address and port

  • src_ip_port (tuple of str and int, optional) – socket style tuple of the IP address and port of the interface that is connecting to SPIDR

Examples

Startup device

>>> timepix = PymepixConnection(('192.168.1.10',50000))

Find how many Timepix are connected

>>> len(timepix)
1

Set the Bias voltage >>> timepix.biasVoltage = 50

Access a specific Timepix device:

>>> timepix[0].deviceName
W0026_K06

Load a config file into timepix

>>> timepix[0].loadSophyConfig('W0026_K06_50V.spx')
property biasVoltage

Bias voltage in volts

property chanAddress
property dataCallback

Function to call when data is received from a timepix device

This has the effect of disabling polling.

data_thread()[source]
enablePolling(maxlen=100)[source]

Enables polling mode

This clears any user defined callbacks and the polling buffer

getDevice(num) TimepixDevice[source]
property isAcquiring
property numDevices
poll(block=False)[source]

If polling is used, returns data stored in data buffer.

the buffer is in the form of a ring and will overwrite older values if it becomes full

Return type:

MessageType , data

property pollBufferLength

Get/Set polling buffer length

Clears buffer on set

start()[source]

Starts acquisition

start_recording(path)[source]
stop()[source]

Stops acquisition

stop_recording()[source]

pymepix.timepix4def module

pymepix.timepix4device module

exception pymepix.timepix4device.BadPixelFormat[source]

Bases: Exception

exception pymepix.timepix4device.ConfigClassException[source]

Bases: Exception

class pymepix.timepix4device.Timepix4Device(tpx4_device, data_queue, pipeline_class=<class 'pymepix.processing.acquisition.PixelPipeline'>)[source]

Bases: object

Provides a control of a timepix4 object

property Vthreshold_coarse
property Vthreshold_fine
property acquisition

Returns the acquisition object

Can be used to set parameters in the acqusition directly for example, to setup TOF calculation when using a PixelPipeline

>>> tpx.acqusition.enableEvents
False
>>> tpx.acquistion.enableEvents = True
property config
devIdToString()[source]

Converts device ID into readable string

Returns:

Device string identifier

Return type:

str

property deviceName
loadConfig(*args, **kwargs)[source]

Loads dac settings from the Config class

pauseHeartbeat()[source]
property pixelMask

Pixel mask set for timepix device

Parameters:

value (numpy.array of int) – 256x256 uint8 threshold mask to set locally

Returns:

Locally stored pixel mask matrix

Return type:

numpy.array of int or None

property pixelTest

Pixel test set for timepix device

Parameters:

value (numpy.array of int) – 256x256 uint8 pixel test to set locally

Returns:

Locally stored pixel test matrix

Return type:

numpy.array of int or None

property pixelThreshold

Threshold set for timepix device

Parameters:

value (numpy.array of int) – 256x256 uint8 threshold to set locally

Returns:

Locally stored threshold matrix

Return type:

numpy.array of int or None

refreshPixels()[source]

Loads timepix pixel configuration to local array

resetPixels()[source]

Clears pixel configuration

resumeHeartbeat()[source]
setConfigClass(klass: TimepixConfig)[source]
setDac(code, value)[source]
setEthernetFilter(eth_filter)[source]

Sets the packet filter, usually set to 0xFFFF to all all packets

setupAcquisition(acquisition_klass, *args, **kwargs)[source]
setupDevice()[source]

Sets up valid parameters for acquisition

This will be manual when other acquisition parameters are working

start()[source]
start_recording(path)[source]
stop()[source]
stop_recording()[source]
uploadPixels()[source]

Uploads local pixel configuration to timepix

pymepix.timepixdef module

class pymepix.timepixdef.DacRegisterCodes(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Ibias_CP_PLL = 17
Ibias_DiscS1_OFF = 9
Ibias_DiscS1_ON = 8
Ibias_DiscS2_OFF = 11
Ibias_DiscS2_ON = 10
Ibias_Ikrum = 4
Ibias_PixelDAC = 12
Ibias_Preamp_OFF = 2
Ibias_Preamp_ON = 1
Ibias_TPbufferIn = 13
Ibias_TPbufferOut = 14
PLL_Vcntrl = 18
VPreamp_NCAS = 3
VTP_coarse = 15
VTP_fine = 16
Vfbk = 5
Vthreshold_coarse = 7
Vthreshold_fine = 6
class pymepix.timepixdef.GrayCounter(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Disable = 0
Enable = 8
Mask = 8
class pymepix.timepixdef.OperationMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

EventiTot = 4
Mask = 6
ToA = 2
ToAandToT = 0
class pymepix.timepixdef.PacketType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Pixel = 1
Trigger = 0
class pymepix.timepixdef.Polarity(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Negative = 1
Positive = 0
class pymepix.timepixdef.SuperPixel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Disable = 0
Enable = 64
Mask = 64
class pymepix.timepixdef.TestPulse(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Disable = 0
Enable = 32
Mask = 32
class pymepix.timepixdef.TestPulseDigAnalog(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

DiscriminatorDigital = 512
FrontEndAnalog = 0
Mask = 512
class pymepix.timepixdef.TestPulseGenerator(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

External = 1024
Internal = 0
Mask = 1024
class pymepix.timepixdef.TimeofArrivalClock(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Mask = 2048
PhaseShiftedGray = 0
SystemClock = 2048
class pymepix.timepixdef.TimerOverflow(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

CycleOverflow = 0
Mask = 128
StopOverflow = 128

pymepix.timepixdevice module

exception pymepix.timepixdevice.BadPixelFormat[source]

Bases: Exception

exception pymepix.timepixdevice.ConfigClassException[source]

Bases: Exception

class pymepix.timepixdevice.TimepixDevice(spidr_device, data_queue, pipeline_class=<class 'pymepix.processing.acquisition.PixelPipeline'>)[source]

Bases: object

Provides high level control of a timepix/medipix object

property Ibias_DiscS1_OFF

[0, 15]

property Ibias_DiscS1_ON

[0, 255]

property Ibias_DiscS2_OFF

[0, 15]

property Ibias_DiscS2_ON

[0, 255]

property Ibias_Ikrum

[0, 255]

property Ibias_PixelDAC

[0, 255]

property Ibias_Preamp_OFF

[0, 15]

property Ibias_Preamp_ON

[0, 255]

property Ibias_TPbufferIn

[0, 255]

property Ibias_TPbufferOut

[0, 255]

property VPreamp_NCAS

[0, 255]

property VTP_coarse

[0, 255]

property VTP_fine

[0, 511]

property Vfbk

[0, 255]

property Vthreshold_coarse

[0, 15]

property Vthreshold_fine

[0, 511]

property acquisition

Returns the acquisition object

Can be used to set parameters in the acqusition directly for example, to setup TOF calculation when using a PixelPipeline

>>> tpx.acqusition.enableEvents
False
>>> tpx.acquistion.enableEvents = True
property config
devIdToString()[source]

Converts device ID into readable string

Returns:

Device string identifier

Return type:

str

property deviceName
property grayCounter
loadConfig(*args, **kwargs)[source]

Loads dac settings from the Config class

property maskPixelsJsonable
property operationMode
pauseHeartbeat()[source]
property pixelMask

Pixel mask set for timepix device

Parameters:

value (numpy.array of int) – 256x256 uint8 threshold mask to set locally

Returns:

Locally stored pixel mask matrix

Return type:

numpy.array of int or None

property pixelTest

Pixel test set for timepix device

Parameters:

value (numpy.array of int) – 256x256 uint8 pixel test to set locally

Returns:

Locally stored pixel test matrix

Return type:

numpy.array of int or None

property pixelThreshold

Threshold set for timepix device

Parameters:

value (numpy.array of int) – 256x256 uint8 threshold to set locally

Returns:

Locally stored threshold matrix

Return type:

numpy.array of int or None

property polarity
refreshPixels()[source]

Loads timepix pixel configuration to local array

resetPixels()[source]

Clears pixel configuration

resumeHeartbeat()[source]
setConfigClass(klass)[source]
setDac(code, value)[source]

Sets the DAC parameter using codes

Parameters:
  • code (int) – DAC code to set

  • value (int) – value to set

setEthernetFilter(eth_filter)[source]

Sets the packet filter, usually set to 0xFFFF to all packets

setupAcquisition(acquisition_klass, *args, **kwargs)[source]
setupDevice()[source]

Sets up valid paramters for acquisition

This will be manual when other acqusition parameters are working

start()[source]
start_recording(path)[source]
stop()[source]
stop_recording()[source]
property superPixel
property testPulse
property testPulseDigitalAnalog
property testPulseGeneratorSource
property timeOfArrivalClock
property timerOverflowControl
update_timer()[source]

Heartbeat thread

uploadPixels()[source]

Uploads local pixel configuration to timepix

pymepix.timepixdevice.main()[source]

Module contents