https://github.com/klafyvel/spefiles.jl
A library to use Lightfield SPE files in Julia.
https://github.com/klafyvel/spefiles.jl
julia lightfield princeton-instruments spectroscopy
Last synced: about 1 month ago
JSON representation
A library to use Lightfield SPE files in Julia.
- Host: GitHub
- URL: https://github.com/klafyvel/spefiles.jl
- Owner: Klafyvel
- License: mit
- Created: 2022-07-11T07:56:40.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-12T16:14:55.000Z (over 1 year ago)
- Last Synced: 2025-01-24T09:41:31.873Z (3 months ago)
- Topics: julia, lightfield, princeton-instruments, spectroscopy
- Language: Julia
- Homepage:
- Size: 532 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SPEFiles
[](https://github.com/klafyvel/SPEFiles.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/Klafyvel/SPEFiles.jl)SPEFiles is a librairy aiming at providing utilities to open Princeton
instruments SPE 3.0 files.The SPE 3.0 specification can be found
[here](https://raw.githubusercontent.com/hududed/pyControl/master/Manual/LightField/Add-in%20and%20Automation%20SDK/SPE%203.0%20File%20Format%20Specification.pdf).The library is inspired by the [spe2py](https://github.com/ashirsch/spe2py)
library, but should provide more features.## Installation
The library is registered. Use
```julia
] add SPEFiles
```## Usage
SPEFiles is best served using DataFrames.jl. Open a file like this :
```julia
using SPEFiles, DataFramesfile = SPEFile("myfile.spe")
df = DataFrame(file)
```You can then simply plot a file like this :
```julia
using CairoMakie
f, ax, l = lines(df.wavelength, df.count, axis=(xlabel="Wavelength (nm)", ylabel="Counts", title="My spectrum"))
save("myspectrum.png", f)
```The columns of the dataframe are `wavelength`, `count`, `frame`, `roi`, `row`, `column`. You can easily handle complex files with multiple frames and regions of interest, or 2D files, using the DataFrame interface.
If you need metadata of the file, the following functions are useful :
- `SPEFile` to open and read a SPE file.
- `exposure` to get the exposure time.
- `experiment` to get the xml representing the experiment in LightField
- `origin_summary` to get file creator informations
- `devices` to get xml data on the devicesYou can also access the XML bits of the file using the `xml` field of the file.
This is an `XMLDocument`, see `LightXML.jl` documentation for how to interact
with it. With that you can retrieve all the experiment parameters used in
LightField.## Contributing
Contributions and feedbacks are welcome. Please reach out using issues !