Metadata-Version: 2.4
Name: nanofinderparser
Version: 0.6.0
Summary: Parse and process Raman and photoluminescence (PL) data files generated by Nanofinder instruments.
Keywords: nanofinderparser
Author: Pablo Solís-Fernández
Author-email: Pablo Solís-Fernández <psolsfer@gmail.com>
License-Expression: BSD-3-Clause
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Dist: numpy>=2.1
Requires-Dist: pandas>=2.1
Requires-Dist: pint>=0.24.4
Requires-Dist: pint-pandas>=0.8.0
Requires-Dist: pyauxlib>=0.16.5
Requires-Dist: pydantic>=2.4.0
Requires-Dist: typer>=0.12
Requires-Dist: xmltodict>=0.10
Maintainer: Pablo Solís-Fernández
Maintainer-email: Pablo Solís-Fernández <psolsfer@gmail.com>
Requires-Python: >=3.12, <3.15
Project-URL: Homepage, https://github.com/psolsfer/nanofinderparser
Project-URL: Repository, https://github.com/psolsfer/nanofinderparser
Project-URL: Documentation, https://nanofinderparser.readthedocs.io
Project-URL: Issues, https://github.com/psolsfer/nanofinderparser/issues
Description-Content-Type: text/markdown

<h1 align="center">NanofinderParser</h1>

<br/>

<!-- Project Badges -->
[![Documentation Status][docs-read-badge]][docs-read-url]
[![License - BSD-3-Clause][license-badge]][license-url]<br/>
[![PyPI - Version][pypi-badge]][pypi-url] [![PyPI - Downloads][pypi-downloads]][pypi-url] [![PyPI - Python Version][python-versions]][pypi-url]<br/>
[![GitHub commit activity][commit-activity]][github-commits] [![GitHub commits since latest release][commits-since-latest]][github-commits] [![GitHub last commit][last-commit]][last-commit-url] [![GitHub Release Date][release-date]][release-date-url]<br/>
[![CI - Tests][ci-badge]][ci-url] [![CD - Publish][cd-badge]][cd-url] [![GitHub stars][stars-badge]][github-url] [![GitHub forks][forks-badge]][github-url] [![GitHub issues][issues-badge]][issues-url]<br/>
[![Linting - Ruff][ruff-badge]][ruff-url]
[![Formatter - Ruff][formatter-ruff-badge]][ruff-url]
[![Types - Mypy][mypy-badge]][mypy-url]<br/>

<h3 align="center">
  <a href="https://github.com/psolsfer/nanofinderparser">GitHub</a>
  &middot;
  <a href="https://pypi.org/project/nanofinderparser/">PyPI</a>
  &middot;
  <a href="https://nanofinderparser.readthedocs.io/en/stable/">Docs</a>
  &middot;
  <a href="https://github.com/psolsfer/nanofinderparser/issues">Issues</a>
</h3>

<h3 align="center">
  Parse and process Raman and photoluminescence (PL) data files generated by Nanofinder instruments.
</h3>

<br/>

---

## Features

- Parse SMD (Scanned Measurement Data) mapping files produced by NanoFinder instruments
- Parse MDT files, which hold individual spectra and 2-D maps rather than a mapping
- Convert spectral data between different units (nm, cm<sup>-1</sup>, eV, Raman shift)
- Export parsed data to CSV files or pandas DataFrames

## Installation

### From PyPI

```bash
pip install nanofinderparser
```

or

```bash
uv add nanofinderparser
```

### From Source

```bash
git clone https://github.com/psolsfer/nanofinderparser.git
cd nanofinderparser
uv sync
```

## Usage

### Quick Start

Here's a simple example of how to use NanofinderParser in python:

```python
from pathlib import Path
from nanofinderparser import load_smd

# Load an SMD file
file_path = Path("path/to/your/smd/file.smd")
mapping_data = load_smd(file_path)

# Access basic information
print(f"Laser wavelength: {mapping_data.laser_wavelength} nm")
print(f"Map size: {mapping_data.map_size}")

# Export data to CSV
mapping_data.to_csv(path=Path("output"), spectral_units="raman_shift")
```

Individual spectra are saved by NanoFinder as MDT files, which are loaded with `load_mdt`:

```python
from pathlib import Path
from nanofinderparser import load_mdt

spectra = load_mdt(Path("path/to/your/mdt/file.mdt"))

for spectrum in spectra:
    print(spectrum.title, spectrum.get_spectral_axis("raman_shift"), spectrum.data)
```

You can also use NanofinderParser from the command line:

```shell
# Convert an SMD file to CSV
nanofinderparser convert path/to/your/smd/file.smd output_folder --units nm

# Convert an MDT file of individual spectra to CSV
nanofinderparser convert-mdt path/to/your/mdt/file.mdt output_folder --units nm

# Display information about a file
nanofinderparser info path/to/your/smd/file.smd
nanofinderparser info-mdt path/to/your/mdt/file.mdt
```

For more detailed usage instructions, please refer to the [documentation](https://nanofinderparser.readthedocs.io/).

### Command Line Interface

```bash
nanofinderparser --help
```

### Python API

```python
import nanofinderparser

# TODO: Add usage examples
```

## Development

### Setup

```bash
git clone https://github.com/psolsfer/nanofinderparser.git
cd nanofinderparser
uv sync
```

Install the prek git hook

```bash
uv run prek install
```

### Running Tests
```bash
uv run pytest
```

### Code Quality

```bash
uv run ruff check .
uv run ruff format .
uv run mypy src/nanofinderparser
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## Credits

This package was created with [Copier](https://github.com/copier-org/copier) and the [Copier PyPackage uv](https://github.com/psolsfer/uvcopier) project template.


<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[docs-read-badge]: https://readthedocs.org/projects/nanofinderparser/badge/?version=stable&style=for-the-badge
[docs-read-url]: https://nanofinderparser.readthedocs.io/en/stable/

[license-badge]: https://img.shields.io/pypi/l/nanofinderparser.svg?style=for-the-badge
[license-url]: https://spdx.org/licenses/BSD-3-Clause.html

[pypi-badge]: https://img.shields.io/pypi/v/nanofinderparser.svg?logo=pypi&label=PyPI&logoColor=gold&style=for-the-badge
[pypi-url]: https://pypi.org/project/nanofinderparser/

[commit-activity]: https://img.shields.io/github/commit-activity/t/psolsfer/nanofinderparser?logo=github&label=Commits&style=for-the-badge
[commits-since-latest]: https://img.shields.io/github/commits-since/psolsfer/nanofinderparser/latest?logo=github&style=for-the-badge
[last-commit]: https://img.shields.io/github/last-commit/psolsfer/nanofinderparser?logo=github&label=Last%20Commit&style=for-the-badge
[release-date]: https://img.shields.io/github/release-date/psolsfer/nanofinderparser?logo=github&label=Release%20Date&style=for-the-badge
[last-commit-url]: https://github.com/psolsfer/nanofinderparser/commit/main
[release-date-url]: https://github.com/psolsfer/nanofinderparser/releases/latest
[github-commits]: https://github.com/psolsfer/nanofinderparser/commits/main/

[pypi-downloads]: https://img.shields.io/pypi/dm/nanofinderparser.svg?color=blue&label=Downloads&logo=pypi&logoColor=gold&style=for-the-badge
[python-versions]: https://img.shields.io/pypi/pyversions/nanofinderparser.svg?logo=python&label=Python&logoColor=gold&style=for-the-badge

[ci-badge]: https://img.shields.io/github/actions/workflow/status/psolsfer/nanofinderparser/test-push-pr.yml?style=for-the-badge&label=CI-Build%20%26%20Test
[ci-url]: https://github.com/psolsfer/nanofinderparser/actions/workflows/test-push-pr.yml

[cd-badge]: https://img.shields.io/github/actions/workflow/status/psolsfer/nanofinderparser/python-publish.yml?style=for-the-badge&label=Release
[cd-url]: https://github.com/psolsfer/nanofinderparser/actions/workflows/python-publish.yml

[stars-badge]: https://img.shields.io/github/stars/psolsfer/nanofinderparser.svg?style=for-the-badge
[forks-badge]: https://img.shields.io/github/forks/psolsfer/nanofinderparser.svg?style=for-the-badge

[issues-badge]: https://img.shields.io/github/issues/psolsfer/nanofinderparser.svg?style=for-the-badge
[issues-url]: https://github.com/psolsfer/nanofinderparser/issues

[github-url]: https://github.com/psolsfer/nanofinderparser

[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json&style=for-the-badge
[ruff-url]: https://github.com/astral-sh/ruff
[formatter-ruff-badge]: https://img.shields.io/badge/Ruff%20Formatter-checked-blue.svg?style=for-the-badge

[mypy-badge]: https://img.shields.io/badge/mypy%20-%20checked-blue?style=for-the-badge
[mypy-url]: https://mypy-lang.org/
