FTIR OMNIC Map Reader
Table of Contents
Description
This code aims to provide a convenient interface for reading FTIR Data specifically OMNIC .MAP files. It loads OMNIC .MAP files into python as Xarray dataset objects. This provides access to the coordinates and spectra of each point in the map.
The underlying code for reading OMINC .MAP files was part of the python package PyMca X-Ray Fluorescence Toolkit. Developed by the European Synchrotron Radiation Facility.
If there is interest in adding particular features please let me know in the issues or make a pull request with the change.
Installation
You will already need to have a python environment installed on your computer to install this software. If you do not have a python environment installed you can use UV to install one.
To install this package you can use pip.
pip install ftir-OMNIC-map-reader
If you are using UV to manage your python environment you can install the package by running the command:
uv add ftir-OMNIC-map-reader
if you are If you would like to install the package from source you can do so by following these steps:
- Download or clone this repository to your computer and save it in a location where it can remain on your computer.
- In the terminal navigate to the directory of the package.
- run the command:
- python -m pip install .
- if you have windows you might need to run: python3 -m pip install .
Directions
Xarray Dataset
To load a map follow this example:
from ftir_map import LoadOmnicMAP as omnic
map_path = "greatest_map_ever.map"
map = omnic.Load_Omnic_Map(map_path)
spectra = map['spectra'] # This is the spectra data
coordinates = map.coords # This contains the spatial and spectral coordinates
metadata = map.attrs # This contains the metadata from the .MAP file
The map is an xarray dataset object. It should contain the three main attributes
- data_vars: This is all of the spectra in the map
- coords: These are the spatial and spectral coordinates of the map
- attrs: this is all of the meta data reported in the .MAP file
If you are unfamiliar with recommend looking at the xarray tutorial
The main benefit of xarray is that it is straightforward to reference the data by spatial and spectral coordinates in the appropriate units. If you choose not to use it you should be able to access the underlying data as numpy arrays.
I eventually hope to provide further guidance for processing the map files efficiently using xarray.
Data as a Dictionary
If you would like to access the data as a dictionary containing the spectra data, spatial and spectral coordiantes, and metadata; you can do so by using the following code:
from ftir_map import LoadOmnicMAP as omnic
map_path = "greatest_map_ever.map"
map_dict = omnic.Load_Omnic_Map_as_dict(map_path)
spectra = map_dict['data'] # This is the spectra data
x_coordinates = map_dict['x'] # This contains the x spatial coordinates
y_coordinates = map_dict['y'] # This contains the y spatial coordinates
wn_coordinates = map_dict['wn'] # This contains the spectral coordinates
metadata = map_dict['metadata'] # This contains the metadata from the .MAP file
License
FTIR OMNIC Map Reader is distributed under the terms of the MIT license.
Metadata
Release files for ftir-OMNIC-map-reader 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ftir_omnic_map_reader-1.0.0.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ftir_omnic_map_reader-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.4 kB
Release files / ftir_omnic_map_reader-1.0.0.tar.gz
| Download URL | ftir_omnic_map_reader-1.0.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c22a9a5a090e0bd57c274e9723611898738cad3ec322e2f94ae92715510c3f7
|
|
BLAKE2b-256 checksum How to use checksums |
82efee4ad8a3992c83f57afe88311cec02d15bb93c69539cdcf5c8bc3e0711c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / ftir_omnic_map_reader-1.0.0-py3-none-any.whl
| Download URL | ftir_omnic_map_reader-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9d6ae67a62bfaf28aec2b75875e101eb771d3bf395f9a8105ff99f4764f7ff3
|
|
BLAKE2b-256 checksum How to use checksums |
0e197cfbdcb47ace0cd0f3d3cb566aeff846096c3a324aa3a0277d5815e07050
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|