Skip to content

Commit

Permalink
Merge pull request #89 from jveitchmichaelis/dev-0.3.X
Browse files Browse the repository at this point in the history
main catching up to v0.3.9
  • Loading branch information
cylammarco authored Mar 25, 2023
2 parents cec48f2 + d82a640 commit cdc1bf5
Show file tree
Hide file tree
Showing 18 changed files with 92 additions and 388 deletions.
22 changes: 20 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 23.1.0
hooks:
- id: black
language_version: python3
args: # arguments to configure black
- --line-length=79

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
# Identify invalid files
- id: check-ast
Expand All @@ -22,3 +22,21 @@ repos:
# Python checks
- id: debug-statements
- id: requirements-txt-fixer

- repo: local
hooks:
- id: remarklint
name: remarklint
language: node
entry: remark
types: [markdown]
args: ["--frail", "--quiet"]
additional_dependencies:
[
remark,
remark-lint,
remark-cli,
remark-preset-lint-recommended,
remark-lint-list-item-indent,
remark-lint-no-undefined-references,
]
12 changes: 11 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
Version 0.3.9
-------------

:Date: 12 Jan 2023

* `@cylammarco <https://github.com/cylammarco>`__:

* Fixed atlas overwriting when provided sequentially
* Capping the numpy version to 1.23.X

Version 0.3.8
-------------

:Date: 29 Nov 2022

* `@cylammarco <https://github.com/cylammarco>`__:

* Fix wrong MANIFEST path
* Fixed wrong MANIFEST path

Version 0.3.7
-------------
Expand Down
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Rascal: RANSAC Assisted Spectral CALibration

[![Python package](https://github.com/jveitchmichaelis/rascal/actions/workflows/python-package.yml/badge.svg)](https://github.com/jveitchmichaelis/rascal/actions/workflows/python-package.yml)
[![Coverage Status](https://coveralls.io/repos/github/jveitchmichaelis/rascal/badge.svg?branch=main)](https://coveralls.io/github/jveitchmichaelis/rascal?branch=main)
[![Readthedocs Status](https://readthedocs.org/projects/rascal/badge/?version=latest&style=flat)](https://rascal.readthedocs.io/en/latest/)
[![Readthedocs Status](https://readthedocs.org/projects/rascal/badge/?version=latest\&style=flat)](https://rascal.readthedocs.io/en/latest/)
[![PyPI version](https://badge.fury.io/py/rascal.svg)](https://badge.fury.io/py/rascal)
[![Downloads](https://pepy.tech/badge/rascal/month)](https://pepy.tech/project/rascal)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4117514.svg)](https://doi.org/10.5281/zenodo.4117514)
Expand All @@ -13,43 +14,48 @@ Given a set of peaks located in your spectrum, Rascal will attempt to determine

Unlike other calibration methods, rascal does not require you to manually select lines in your spectrum. Ideally you should know approximate parameters about your system, namely:

* What arc lamp was used (e.g. Xe, Hg, Ar, CuNeAr)
* What the dispersion of your spectrometer is (i.e. angstroms/pixel)
* The spectral range of your system, and the starting wavelength
* What arc lamp was used (e.g. Xe, Hg, Ar, CuNeAr)
* What the dispersion of your spectrometer is (i.e. angstroms/pixel)
* The spectral range of your system, and the starting wavelength

You don't need to know the dispersion and start wavelength exactly. Often this information is provided by the observatory, but if you don't know it, you can take a rough guess. The closer you are to the actual system settings, the more likely it is that Rascal will be able to solve the calibration. Blind calibration, where no parameters are known, is possible but challenging currently. If you don't know the lamp, you can try iterating over the various combinations of sources. Generally when you do get a correct fit, with most astronomical instruments the errors will be extremely low.

More background information can be referred to this [arXiv article](https://ui.adsabs.harvard.edu/abs/2019arXiv191205883V/abstract).


## Dependencies
* python >= 3.6
* numpy
* scipy
* pynverse
* matplotlib

* python >= 3.7
* numpy>=1.16,<1.24
* scipy>=1.3.3
* pynverse>=0.1.4
* matplotlib>=3.0.3
* tqdm>=4.48.0

## Optional Dependencies
* [plotly](https://github.com/plotly/plotly.py) >= 4.0

* [plotly](https://github.com/plotly/plotly.py) >= 4.0

## Installation

Instructions can be found [here](https://rascal.readthedocs.io/en/latest/installation/installation.html).

## Reporting issues/feature requests

Please use the [issue tracker](https://github.com/jveitchmichaelis/rascal/issues) to report any issues or support questions.

## Getting started

The [quickstart guide](https://rascal.readthedocs.io/en/latest/tutorial/quickstart.html) will show you how to reduce the example dataset.

## Contributing Code/Documentation

If you are interested in contributing code to the project, thank you! For those unfamiliar with the process of contributing to an open-source project, you may want to read through Github’s own short informational section on how to submit a [contribution](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution) or send me a message.

Style -- we now use black for formatting, you can easily set this up using a pre-commit hook.

```
pip install pre-commit
pre-commit install
```
pip install pre-commit
pre-commit install

## Disclaimer

We duplicate some of the relevant metadata, but we do not process the raw metadata. Some of the metadata this software creates contain full path to the files in your system, which most likely includes a user name on your machine. Please be advised it is your responsibility to be compliant with the privacy law(s) that you are oblidged to follow, and it is your responsibility to remove any metadata that may reveal personal information and/or provide information that can reveal any computing vulunerability.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
matplotlib>=3.0.3
numpy>=1.16
numpy>=1.16,<1.24
pynverse>=0.1.4
scipy>=1.3.3
tqdm>=4.48.0
5 changes: 2 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = rascal
version = 0.3.8.1
version = 0.3.9
license = BSD-3-Clause
license_files = LICENSE
description = A library for automated spectrometer wavelength calibration.
Expand All @@ -16,7 +16,6 @@ download_url = https://github.com/jveitchmichaelis/rascal
classifiers =
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Expand All @@ -32,7 +31,7 @@ packages = find:
include_package_data = True
python_requires = >=3.6
install_requires =
numpy>=1.16
numpy>=1.16,<1.24
scipy>=1.3.3
pynverse>=0.1.4
matplotlib>=3.0.3
Expand Down
16 changes: 0 additions & 16 deletions src/rascal/atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,39 +152,32 @@ def add(
"""

if min_atlas_wavelength is None:

min_atlas_wavelength = (
self.min_atlas_wavelength - self.range_tolerance
)

if max_atlas_wavelength is None:

max_atlas_wavelength = (
self.max_atlas_wavelength + self.range_tolerance
)

if not np.isfinite(min_atlas_wavelength):

raise ValueError(
"min_atlas_wavelength has to be finite or None. "
"{} is given.".format(min_atlas_wavelength)
)

if not np.isfinite(max_atlas_wavelength):

raise ValueError(
"max_atlas_wavelength has to be finite or None. "
"{} is given.".format(max_atlas_wavelength)
)

if isinstance(elements, str):

elements = [elements]

if elements is not None:

for element in elements:

(
atlas_elements_tmp,
atlas_tmp,
Expand Down Expand Up @@ -254,21 +247,16 @@ def add_user_atlas(
"""

if not isinstance(elements, list):

elements = list(elements)

if not isinstance(wavelengths, list):

wavelengths = list(wavelengths)

if intensities is None:

intensities = [0] * len(wavelengths)

else:

if not isinstance(intensities, list):

intensities = list(intensities)

assert len(elements) == len(wavelengths), ValueError(
Expand All @@ -279,7 +267,6 @@ def add_user_atlas(
)

if vacuum:

wavelengths = vacuum_to_air_wavelength(
wavelengths, temperature, pressure, relative_humidity
)
Expand Down Expand Up @@ -338,9 +325,7 @@ def remove_atlas_lines_range(self, wavelength, tolerance=10):
"""

for atlas_line in self.atlas_lines:

if abs(atlas_line.wavelength - wavelength) < tolerance:

self.atlas_lines.remove(atlas_line)

def list(self):
Expand All @@ -350,7 +335,6 @@ def list(self):
"""

for line in self.atlas_lines:

print(
"Element "
+ str(line.element)
Expand Down
Loading

0 comments on commit cdc1bf5

Please sign in to comment.