Skip to main content

xsptools - Collection of python packages to process data originating from X-Spectrum detectors

Project description

xsptools

xsptools is a collection of python packages for the processing of data originating from X-Spectrum detectors. Therefore, each package should be used in conjunction with a library that allows access to a detector, such as pyxsp [1].

Installation

xsptools requires:

  • Python >= 3.8
  • Numpy >= 1.6

The package itself can be installed with pip:

$ pip install xsptools

Supported packages

The following packages are supported by xsptools:

Each package can be imported specifying its name, for example:

from xsptools import binning

xsptools.binning

xsptools.binning is a package that is used to perform 3x3 binning of frames generated by X-Spectrum detectors. The only supported detector at the moment is a Lambda CdTe 750k. The main object is the Processor, which is instantiated by passing the frame dimensions:

from xsptools import binning
p = binning.Processor(516,1554)

Its functionality is to bin frames, which must be passed as 2-dimensional numpy arrays with the same dimensions as those passed to the Processor. It is also possible to add to the Processor the detector pixel mask, which is used to interpolate bad pixels (before binning, each bad pixel is set to be the average of its neighbors). This procedure is generally recommended as it results in better looking binned frames. The Processor's full API can be exposed via:

from xsptools import binning
help(binning.Processor)

The following is a complete code example that shows how to use the package:

from xsptools import binning
import numpy as np
import matplotlib.pyplot as plt


p = binning.Processor(frame_height=516, frame_width=1556)

# Mock pixel mask
pixel_mask = np.zeros(shape=(516,1554), dtype=np.uint32)
p.add_pixel_mask(pixel_mask)

# Mock frame
frame = np.random.randint(0, 256, size=(516,1554), dtype=np.uint8)
binned_frame = p.bin_frame(frame)

height = p.binned_frame_height
width = p.binned_frame_width
plt.imshow(binned_frame, extent=(0,width,height,0))
plt.show()

Licensing

The xsptools package is licensed under the terms of the BSD 3-clause license (also known as Modified BSD License).

References

[1] pyxsp User Manual, Version 3.3, March 2024, X-Spectrum

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xsptools-1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xsptools-1.0.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file xsptools-1.0.0.tar.gz.

File metadata

  • Download URL: xsptools-1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for xsptools-1.0.0.tar.gz
Algorithm Hash digest
SHA256 360342127c1b04b34f8488fc8dcde78ce05a43c113965fca20a439bc2f5bf78b
MD5 bfcc11e226456a36195a02bd336c6fd5
BLAKE2b-256 78511e588295679630b3e8688627d91042b50081f04f646f0802b0da7449bf7e

See more details on using hashes here.

File details

Details for the file xsptools-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: xsptools-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for xsptools-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d92d04be86b1e23b3e5cbfc24365862800d78cc4015641d01a6bd4990c9755
MD5 cf1c03c716e7fa716a6e0582145187f5
BLAKE2b-256 1312d234467246886d80e6405cbf0c783098ae203555eafd30d7f9307d391487

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page