Skip to content

Commit

Permalink
Format, Test more ROOT/Python versions, prepare release 22.01 (#23)
Browse files Browse the repository at this point in the history
Format, Test more ROOT/Python versions, prepare release 22.01
  • Loading branch information
janmayer authored Feb 3, 2022
1 parent 42dc9b6 commit 83982c1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
# - '6.22.00', '6.22.02' are incompatible
# - 6.22.4 missing from https://anaconda.org/conda-forge/root/files
python-version: [3.6, 3.7, 3.8]
root-version: ['6.16.00', '6.20.2', '6.20.4', '6.20.6', '6.22.6', '6.22.8', '6.24.0']
root-version: ['6.16.00', '6.20.2', '6.20.4', '6.20.6', '6.22.6', '6.22.8', '6.24.0', '6.24.2', '6.24.4', '6.24.6']
exclude:
- python-version: 3.8
root-version: '6.16.00'
Expand All @@ -25,6 +25,14 @@ jobs:
root-version: '6.22.8'
- python-version: 3.9
root-version: '6.24.0'
- python-version: 3.9
root-version: '6.24.2'
- python-version: 3.9
root-version: '6.24.4'
- python-version: 3.9
root-version: '6.24.6'
- python-version: '3.10'
root-version: '6.24.6'
fail-fast: false

steps:
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# HDTV Changelog

## 22.01
- Added support for running hdtv from a Docker container (@lindt)
- Enabled command line suggestions and history (@j-kleemann)
- Test more ROOT versions
- Test Python 3.10

## 21.04
- Fix error with errormessage in cal pos nuc (@jmayer)
- Test more ROOT versions
Expand Down
1 change: 0 additions & 1 deletion hdtv/tabformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def get_term_width():
except BaseException:
return 80


except ImportError:
# On platforms where we cannot load the curses library, we assume a
# terminal width of 80 characters
Expand Down
2 changes: 1 addition & 1 deletion tests/mat/tvcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self):

def Cut(self, matfile, r1, r2):
tempdir = "/home/braun/Diplom/temp"
fname = "%032X.asc" % random.randint(0, 2 ** 128)
fname = "%032X.asc" % random.randint(0, 2**128)

tvcmds = "cut activate 0; "
tvcmds += "cut attach matrix 1; "
Expand Down
22 changes: 11 additions & 11 deletions tests/peak/peakgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def __init__(self, pos, vol, fwhm, tl=None, tr=None, sh=None, sw=None):
# Contribution from left tail and left half of truncated Gaussian
if self.tl:
norm = (
self.sigma ** 2
self.sigma**2
/ self.tl
* math.exp(-self.tl ** 2 / (2 * self.sigma ** 2))
* math.exp(-self.tl**2 / (2 * self.sigma**2))
)
norm += (
math.sqrt(math.pi / 2)
Expand All @@ -72,9 +72,9 @@ def __init__(self, pos, vol, fwhm, tl=None, tr=None, sh=None, sw=None):
# Contribution from right tail and right half of truncated Gaussian
if self.tr:
norm += (
self.sigma ** 2
self.sigma**2
/ self.tr
* math.exp(-self.tr ** 2 / (2 * self.sigma ** 2))
* math.exp(-self.tr**2 / (2 * self.sigma**2))
)
norm += (
math.sqrt(math.pi / 2)
Expand All @@ -98,11 +98,11 @@ def step(self, x):
def value(self, x):
dx = x - self.pos
if self.tl is not None and dx < -self.tl:
_y = self.tl / (self.sigma ** 2) * (dx + self.tl / 2)
_y = self.tl / (self.sigma**2) * (dx + self.tl / 2)
elif self.tr is not None and dx > self.tr:
_y = -self.tr / (self.sigma ** 2) * (dx - self.tr / 2)
_y = -self.tr / (self.sigma**2) * (dx - self.tr / 2)
else:
_y = -(dx ** 2) / (2 * self.sigma ** 2)
_y = -(dx**2) / (2 * self.sigma**2)

return self.amp * (math.exp(_y) + self.step(x))

Expand All @@ -121,15 +121,15 @@ def __init__(self, pos, amp, sigma1, sigma2, eta, gamma):
def value(self, x):
dx = x - self.pos
if dx <= 0:
_y = math.exp(-math.log(2) * dx ** 2 / self.sigma1 ** 2)
_y = math.exp(-math.log(2) * dx**2 / self.sigma1**2)
elif dx <= self.eta * self.sigma2:
_y = math.exp(-math.log(2) * dx ** 2 / self.sigma2 ** 2)
_y = math.exp(-math.log(2) * dx**2 / self.sigma2**2)
else:
B = self.sigma2 * self.gamma - 2.0 * self.sigma2 * self.eta ** 2 * math.log(
B = self.sigma2 * self.gamma - 2.0 * self.sigma2 * self.eta**2 * math.log(
2
)
B /= 2.0 * self.eta * math.log(2)
A = 2 ** (-self.eta ** 2) * (self.sigma2 * self.eta + B) ** self.gamma
A = 2 ** (-self.eta**2) * (self.sigma2 * self.eta + B) ** self.gamma
_y = A / (B + dx) ** self.gamma

return _y * self.amp
Expand Down

0 comments on commit 83982c1

Please sign in to comment.