pymepix package

Subpackages

Submodules

pymepix.main module

Main module for pymepix

pymepix.main.connect_timepix(args)[source]
pymepix.main.main()[source]
pymepix.main.post_process(args)[source]

pymepix.post_processing module

class pymepix.post_processing.ProgressBar(iterable=None, desc=None, total=None, leave=True, file=None, ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None, ascii=None, disable=False, unit='it', unit_scale=False, dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, position=None, postfix=None, unit_divisor=1000, write_bytes=False, lock_args=None, nrows=None, colour=None, delay=0, gui=False, **kwargs)[source]

Bases: tqdm.std.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, 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(spidr_address=('192.168.1.10', 50000), src_ip_port=('192.168.1.1', 8192), pipeline_class=<class 'pymepix.processing.acquisition.PixelPipeline'>)[source]

Bases: pymepix.core.log.Logger

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 = Pymepix(('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')
biasVoltage

Bias voltage in volts

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) → pymepix.timepixdevice.TimepixDevice[source]
isAcquiring
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

Returns:
Return type:MessageType , data
pollBufferLength

Get/Set polling buffer length

Clears buffer on set

start()[source]

Starts acquisition

stop()[source]

Stops acquisition

pymepix.timepixdef module

class pymepix.timepixdef.DacRegisterCodes[source]

Bases: enum.IntEnum

An enumeration.

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[source]

Bases: enum.IntEnum

An enumeration.

Disable = 0
Enable = 8
Mask = 8
class pymepix.timepixdef.OperationMode[source]

Bases: enum.IntEnum

An enumeration.

EventiTot = 4
Mask = 6
ToA = 2
ToAandToT = 0
class pymepix.timepixdef.PacketType[source]

Bases: enum.Enum

An enumeration.

Pixel = 1
Trigger = 0
class pymepix.timepixdef.Polarity[source]

Bases: enum.IntEnum

An enumeration.

Negative = 1
Positive = 0
class pymepix.timepixdef.SuperPixel[source]

Bases: enum.IntEnum

An enumeration.

Disable = 0
Enable = 64
Mask = 64
class pymepix.timepixdef.TestPulse[source]

Bases: enum.IntEnum

An enumeration.

Disable = 0
Enable = 32
Mask = 32
class pymepix.timepixdef.TestPulseDigAnalog[source]

Bases: enum.IntEnum

An enumeration.

DiscriminatorDigital = 512
FrontEndAnalog = 0
Mask = 512
class pymepix.timepixdef.TestPulseGenerator[source]

Bases: enum.IntEnum

An enumeration.

External = 1024
Internal = 0
Mask = 1024
class pymepix.timepixdef.TimeofArrivalClock[source]

Bases: enum.IntEnum

An enumeration.

Mask = 2048
PhaseShiftedGray = 0
SystemClock = 2048
class pymepix.timepixdef.TimerOverflow[source]

Bases: enum.IntEnum

An enumeration.

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: pymepix.core.log.Logger

Provides high level control of a timepix/medipix object

Ibias_DiscS1_OFF

[0, 15]

Ibias_DiscS1_ON

[0, 255]

Ibias_DiscS2_OFF

[0, 15]

Ibias_DiscS2_ON

[0, 255]

Ibias_Ikrum

[0, 255]

Ibias_PixelDAC

[0, 255]

Ibias_Preamp_OFF

[0, 15]

Ibias_Preamp_ON

[0, 255]

Ibias_TPbufferIn

[0, 255]

Ibias_TPbufferOut

[0, 255]

VPreamp_NCAS

[0, 255]

VTP_coarse

[0, 255]

VTP_fine

[0, 511]

Vfbk

[0, 255]

Vthreshold_coarse

[0, 15]

Vthreshold_fine

[0, 511]

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
config
devIdToString()[source]

Converts device ID into readable string

Returns:Device string identifier
Return type:str
deviceName
grayCounter
loadConfig(*args, **kwargs)[source]

Loads dac settings from the Config class

operationMode
pauseHeartbeat()[source]
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
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
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
polarity
refreshPixels()[source]

Loads timepix pixel configuration to local array

resetPixels()[source]

Clears pixel configuration

resumeHeartbeat()[source]
setConfigClass(klass: pymepix.config.timepixconfig.TimepixConfig)[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 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]
superPixel
testPulse
testPulseDigitalAnalog
testPulseGeneratorSource
timeOfArrivalClock
timerOverflowControl
update_timer()[source]

Heartbeat thread

uploadPixels()[source]

Uploads local pixel configuration to timepix

pymepix.timepixdevice.main()[source]

Module contents