Metadata-Version: 2.5
Name: backscattermeter_analyzer
Version: 3.0.7
Summary: Tool to work on the backscattermeter at LAPP
Project-URL: Documentation, https://git.linarphy.net/linarphy/backscattermeter_analyzer/wiki
Project-URL: Homepage, https://git.linarphy.net/linarphy/backscattermeter_analyzer
Project-URL: Source, https://git.linarphy.net/linarphy/backscattermeter_analyzer
Project-URL: Issues, https://git.linarphy.net/linarphy/backscattermeter_analyzer/issues
Author-email: linarphy <linarphy@linarphy.net>
License-File: LICENSE
Keywords: backscattered light,virgo
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.14.7
Requires-Dist: gwpy>=3.0.12
Requires-Dist: lalsuite>=7.26.15
Requires-Dist: pyqt6>=6.9.1
Requires-Dist: pyusb>=1.3.1
Requires-Dist: rich>=13.9.4
Description-Content-Type: text/markdown

# Backscattermeter analyzer

Help working with [the backscattermeter at LAPP](https://doi.org/10.48550/arXiv.2202.07370).

This tools can characterize the experiment itself, or make
${ f } _ { sc }$ or *BRDF* measurement with a focus on uncertainty
propagation.

## Getting started

### Requirements

- Python >= 3.14
- GWpy >= 3.0.12 (data type, computation)
- pyusb >= 1.3.1 (interaction with actuator/sensor - not used yet)
- pyqt6 >= 6.9.1 (visualization - not used yet)
- rich >= 13.9.4 (console output)
- lalsuite >= 7.26.15 (data format - not used yet)

### Installation

To install this package in the current python environment, use

```sh
python -m pip install backscattermeter_analyzer
```

### Usage

```py
from backscattermeter_analyzer import (
    Acquisition,
    AnalysisBuilder,
    Backscattermeter,
    Camera,
    ProtocolBuilder,
)
from gwpy.timeseries import TimeSeriesDict

# build a protocol with a camera that save the position of the beam and
# with a snail movement of the motor.
protocol = (
    ProtocolBuilder(Backscattermeter())
    .with_camera_on_suspended_bench(
        camera=Camera(
            id_="an nice identifier of the camera for human",
            serial_number="1359",
        ),
        position=3e-2, # in m
        error=5e-3, # in m
    )
    .with_camera_channels( # X and Y are reversed on this camera !
        pos_x="V1:Camera_scatter_FitPosY",
        pos_y="V1:Camera_scatter_FitPosX",
    )
    .with_snail_motor_path(
        number=3,
        duration=10,
        speed=50,
        step_numbers=(100, 100, 100, 100),
    )
    .build()
)
# convert it to an acquisition with real data
acquisition = Acquisition(
    protocol=protocol,
    data=TimeSeriesDict.read("data.gwf"),
)

# build an analysis where we will get the time interval in which the
# motor is moving. We don't want these data as they are noisy, so this
# can be used later for another analysis that needs stable segment.
analysis = (
    AnalysisBuilder()
    .with_step_split([acquisition])
    .build()
)

# run the analysis, return a result object
result = analysis.run()

print(result.representation.structure.with_step_split[0].start_times[0])
# this will print the start of the segment that contains transition data
# in camera position measurement.
```

## Documentation

A complete documentation will be available soon, in a wiki.

## Development

### Development Requirements

This project use [mise](https://mise.jdx.dev) to manage development
tools.

> [!TIP]
> If [mise](https://mise.jdx.dev) is installed, and
> [mise.toml](mise.toml) is trusted with `mise trust`, all tools can be
> installed automatically with `mise install`

This project use the following tools:

- [just](https://just.systems): command runner
- [hatch](https://hatch.pypa.io): project manager and package builder
- [uv](https://docs.astral.sh/uv): package installer
- [ruff](https://docs.astral.sh/ruff): python linter and formatter
- [ty](https://docs.astra.sh/ty): python type checker
- [jujutsu](https://jj-vcs.dev): version control

> [!NOTE]
> Tools used in the project consume and produce interoperable format to
> avoid vendor lock-in. This is the toolchain of the current maintener.

### Development Usage

[just](https://just.system) can be used to speed up development for an
identical toolchain.

Before making a commit, `just fix` will run all tests, format the code,
lint and type check. If you don’t want to modify the code, `just check`
will run all tests, lint and type check without any attempt to fix any
issue.

Before a version change, `just release` will push all local commits to
repository and publish the new package version.

All available commands can be listed with `just -l`.

## License

This project is licensed under the GNU GPL v3+.
See [license file](LICENSE) for more information.

## Acknowledgement

Thanks to all the people that worked on the tools used, like python,
neovim and mise.
