Skip to content

Commit

Permalink
Merge 4758a61 into cec48f2
Browse files Browse the repository at this point in the history
  • Loading branch information
cylammarco committed Feb 19, 2023
2 parents cec48f2 + 4758a61 commit 1dbc397
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 22.12.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 Down
12 changes: 11 additions & 1 deletion CHANGELOG.rst
@@ -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
11 changes: 6 additions & 5 deletions README.md
Expand Up @@ -23,11 +23,12 @@ More background information can be referred to this [arXiv article](https://ui.a


## 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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -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
@@ -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
43 changes: 30 additions & 13 deletions src/rascal/calibrator.py
Expand Up @@ -1438,19 +1438,36 @@ def add_atlas(

max_atlas_wavelength = self.max_wavelength + self.range_tolerance

new_atlas = Atlas(
elements,
min_atlas_wavelength=min_atlas_wavelength,
max_atlas_wavelength=max_atlas_wavelength,
min_intensity=min_intensity,
min_distance=min_distance,
range_tolerance=self.range_tolerance,
vacuum=vacuum,
pressure=pressure,
temperature=temperature,
relative_humidity=relative_humidity,
)
self.atlas = new_atlas
if self.atlas is None:

new_atlas = Atlas(
elements,
min_atlas_wavelength=min_atlas_wavelength,
max_atlas_wavelength=max_atlas_wavelength,
min_intensity=min_intensity,
min_distance=min_distance,
range_tolerance=self.range_tolerance,
vacuum=vacuum,
pressure=pressure,
temperature=temperature,
relative_humidity=relative_humidity,
)
self.atlas = new_atlas

else:

self.atlas.add(
elements,
min_atlas_wavelength=min_atlas_wavelength,
max_atlas_wavelength=max_atlas_wavelength,
min_intensity=min_intensity,
min_distance=min_distance,
vacuum=vacuum,
pressure=pressure,
temperature=temperature,
relative_humidity=relative_humidity,
)

self.candidate_tolerance = candidate_tolerance
self.constrain_poly = constrain_poly

Expand Down
14 changes: 9 additions & 5 deletions src/rascal/plotting.py
Expand Up @@ -990,6 +990,10 @@ def plot_fit(

spec_max = np.nanmax(spectrum) * 1.05

else:

spec_max = vline_max

fitted_peaks = []
fitted_peaks_adu = []
fitted_diff = []
Expand Down Expand Up @@ -1026,12 +1030,12 @@ def plot_fit(
fitted_peaks_adu.append(
spectrum[int(calibrator.pix_to_rawpix(p))]
)
fitted_diff.append(diff[idx])
calibrator.logger.info(
"- matched to {} A".format(
calibrator.atlas.get_lines()[idx]
)
fitted_diff.append(diff[idx])
calibrator.logger.info(
"- matched to {} A".format(
calibrator.atlas.get_lines()[idx]
)
)

x_fitted = calibrator.polyval(fitted_peaks, fit_coeff)

Expand Down
2 changes: 1 addition & 1 deletion test/test_effective_pixel.py
Expand Up @@ -44,7 +44,7 @@ def test_providing_effective_pixel_not_affecting_fit(mock_show):
range_tolerance=100.0, min_wavelength=100.0, max_wavelength=1300.0
)

c.set_ransac_properties(linear=False, minimum_fit_error=1e-12)
c.set_ransac_properties(linear=False, minimum_fit_error=1e-14)

# Add our fake lines as the atlas
a.add_user_atlas(elements=["Test"] * len(waves), wavelengths=waves)
Expand Down

0 comments on commit 1dbc397

Please sign in to comment.