Metadata-Version: 2.4
Name: tasvisan
Version: 0.2.1
Summary: Toolkit for data reduction, normalization, combination, visualization and analysis of triple-axis spectrometers, especially for Taipan and Sika
Author: Guochu Deng
Author-email: Guochu Deng <gc.deng.ansto@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/gcdengansto/TasVisAn
Project-URL: Repository, https://github.com/gcdengansto/TasVisAn
Keywords: neutron,scattering,resolution,inelastic,spectrometer,triple-axis
Platform: Windows
Platform: Linux
Platform: Mac OS X
Platform: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20
Requires-Dist: matplotlib>=3.5
Requires-Dist: scipy>=1.7
Requires-Dist: pandas>=1.3
Requires-Dist: lmfit>=1.0
Requires-Dist: h5py>=3.0
Requires-Dist: plotly>=5.0
Requires-Dist: inspy-conv
Requires-Dist: QtPy
Requires-Dist: PySide6
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: author
Dynamic: license-file
Dynamic: platform

# TasVisAn

**TasVisAn** is a Python library for data reduction, visualization, and analysis of neutron triple-axis spectrometers (TASs), particularly for the thermal-neutron triple-axis spectrometer Taipan and cold-neutron triple-axis spectrometer Sika at Australian Centre for Neutron Scattering, ANSTO. It can also be used for other triple-axis spectrometers in other facilities, for example, the thermal-neutron triple-axis spectrometer BT7 and the cold-neutron triple-axis spectrometer BT4 at NIST. More triple-axis spectrometers will be supported soon.

> Install name: `tasvisan`  
> Import name: `tasvisan`
> Current package version: `0.2.1`

---

## 🚀 Installation

```bash
pip install tasvisan
```

## 📦 Usage

```python
import tasvisan

# Create an instrument-specific object
taipan = tasvisan.Taipan(expnum=12345, title="Example", sample="Sample", user="User")

# Load a scan (edit the path for your experiment data)
df = taipan.taipan_data_to_pd(path=r"D:\data", scanno=1)
print(df.head())
```

Run the Qt data browser after installing the package:

```bash
tasvisan
# or
python -m tasvisan
```
The `tasvisan` command is provided by the package entry point in `pyproject.toml`.

On Linux distributions such as Ubuntu or Linux Mint, Qt/OpenGL warnings may appear:

```bash
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user'
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: virtio_gpu
```

Add the following lines to `~/.bashrc`:

```bash
# Ensure always render the GUI using software
export LIBGL_ALWAYS_SOFTWARE=1

# Ensure XDG_RUNTIME_DIR exists for third-party apps
if [ -z "$XDG_RUNTIME_DIR" ]; then
    export XDG_RUNTIME_DIR=/tmp/runtime-$USER
    if [ ! -d "$XDG_RUNTIME_DIR" ]; then
        mkdir -p "$XDG_RUNTIME_DIR"
        chmod 0700 "$XDG_RUNTIME_DIR"
    fi
fi
```

Then run:

```bash
source ~/.bashrc
```

## 🎯 Features

- Instrument-specific parsing for Taipan, Sika, BT7, and BT4
- Data normalization, combination, flattening, and HKLW export
- Simple, combined, and spline plotting
- Random and grid-style contour mapping
- Resolution-convolution initialization and fitting
- Taipan and Sika command validation and scan simulation
- Sika multichannel reduction and 3D plotting
- Taipan and Sika HDF/data conversion support
- Qt-based data browsing and visualization GUI
- NumPy, pandas, Matplotlib, Plotly, lmfit, and HDF5 integration


## 📁 Project Structure
```bash
tasvisan/
├── src/tasvisan/     # Main package (import tasvisan)
├── pyproject.toml    # Build configuration
├── README.md
└── LICENSE
```

## 🔬 Scope

This package is intended for:

> Triple-axis Spectrometer Data Reduction, Normalization, Visualization, and Analysis

> Quick Data Combination and Contour Mapping

> Resolution Convolution Fitting to Inelastic Neutron Scattering Data

> Experimental Planning and Command Validation and Simulation

> Data Reduction and 3D Visualization of Multiplexing and Multi-analyzer Triple-axis Spectrometers

## 🛠️ Development

Repository:

https://github.com/gcdengansto/TasVisAn


Install in editable mode:
```bash
pip install -e .
```

## 📖 Documentation

The documentation sources are in the [`docs/`](docs/) directory. They include
installation instructions, a quickstart, instrument notes, GUI guidance,
troubleshooting, and the API reference.

Build the HTML documentation locally with:

```bash
pip install -r docs/requirements-docs.txt
mkdocs build
```

Additional project information is available at
https://github.com/gcdengansto/TasVisAn.

## 🤝 Contributing

Please contact the author for fixing bugs and adding additional functions


## 📜 License

This project is licensed under the MIT License — see the LICENSE file for details.

## 👤 Author

Guochu Deng

Email: gc.deng.ansto@gmail.com

## ⚠️ Disclaimer

This software is provided for scientific research purposes.
No guarantees are made regarding correctness or fitness for a particular application.
