Skip to content

Commit b6c1446

Browse files
committed
clean up a style warning; update test matrix
1 parent c7c3814 commit b6c1446

File tree

15 files changed

+120
-143
lines changed

15 files changed

+120
-143
lines changed

.github/workflows/ci_workflows.yml

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,24 @@ jobs:
3737
toxargs: -v
3838
toxposargs: --remote-data=astropy
3939

40-
- name: Python 3.11 (Windows)
40+
- name: Python 3.12 (Windows)
4141
os: windows-latest
42-
python: 3.11
42+
python: '3.12'
4343
toxenv: py311-test
4444

45-
- name: Python 3.11 (MacOS X)
45+
- name: Python 3.10 (MacOS X)
4646
os: macos-latest
47-
python: 3.11
47+
python: '3.10'
4848
toxenv: py311-test
4949

5050
- name: Python 3.10
5151
os: ubuntu-latest
5252
python: '3.10'
5353
toxenv: py310-test
5454

55-
- name: Python 3.9
56-
os: ubuntu-latest
57-
python: 3.9
58-
toxenv: py39-test
59-
60-
- name: Python 3.8 with oldest supported version of key dependencies
61-
os: ubuntu-20.04
62-
python: 3.8
55+
- name: Python 3.10 with oldest supported version of key dependencies
56+
os: ubuntu-22.04
57+
python: '3.10'
6358
toxenv: py38-test-oldestdeps
6459

6560
steps:
@@ -71,13 +66,13 @@ jobs:
7166
uses: actions/setup-python@v5
7267
with:
7368
python-version: ${{ matrix.python }}
74-
- name: Install language-pack-de and tzdata
75-
if: startsWith(matrix.os, 'ubuntu')
76-
run: |
77-
sudo apt-get update
78-
sudo apt-get install language-pack-de tzdata graphviz
69+
# - name: Install language-pack-de and tzdata
70+
# if: startsWith(matrix.os, 'ubuntu')
71+
# run: |
72+
# sudo apt-get update
73+
# sudo apt-get install language-pack-de tzdata graphviz
7974
- name: Install Python dependencies
80-
run: python -m pip install --upgrade tox codecov
75+
run: python -m pip install --upgrade tox
8176
- name: Run tests
8277
env:
8378
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
@@ -91,10 +86,10 @@ jobs:
9186
fail-fast: false
9287
matrix:
9388
include:
94-
- name: (Allowed Failure) Python 3.11 with development versions of key dependencies
89+
- name: (Allowed Failure) Python 3.13 with development versions of key dependencies
9590
os: ubuntu-latest
96-
python: '3.11'
97-
toxenv: py311-test-devdeps
91+
python: '3.13'
92+
toxenv: py313-test-devdeps
9893
toxargs: -v
9994

10095
- name: (Allowed Failure) Python 3.12 with remote data and dev version of key dependencies
@@ -113,13 +108,13 @@ jobs:
113108
uses: actions/setup-python@v5
114109
with:
115110
python-version: ${{ matrix.python }}
116-
- name: Install language-pack-de and tzdata
117-
if: startsWith(matrix.os, 'ubuntu')
118-
run: |
119-
sudo apt-get update
120-
sudo apt-get install language-pack-de tzdata
111+
# - name: Install language-pack-de and tzdata
112+
# if: startsWith(matrix.os, 'ubuntu')
113+
# run: |
114+
# sudo apt-get update
115+
# sudo apt-get install language-pack-de tzdata
121116
- name: Install Python dependencies
122-
run: python -m pip install --upgrade tox codecov
117+
run: python -m pip install --upgrade tox
123118
- name: Run tests
124119
# This is the specific switch for allowed failures.
125120
continue-on-error: true

pydl/pydlspec2d/spec1d.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ def gstep(self):
195195
d = np.zeros((K, K, M), dtype=self.a.dtype)
196196
if self.epsilon is not None and self.epsilon > 0:
197197
foo = self.epsilon * np.eye(K, dtype=self.a.dtype)
198-
for l in range(M):
199-
d[:, :, l] = foo
200-
if l > 0 and l < M-1:
201-
d[:, :, l] *= 2
198+
for ll in range(M):
199+
d[:, :, ll] = foo
200+
if ll > 0 and ll < M-1:
201+
d[:, :, ll] *= 2
202202
# d[:, :, 0] = foo
203203
# d[:, :, 1:M-1] = 2*foo
204204
# d[:, :, M-1] = foo
@@ -1536,10 +1536,10 @@ def template_input(inputfile, dumpfile, flux=False, verbose=False):
15361536
istart = k*nfluxes
15371537
iend = min(istart+nfluxes, nspectra) - 1
15381538
fig, ax = plt.subplots(1, 1, figsize=_default_figsize, dpi=100)
1539-
for l in range(istart, iend+1):
1539+
for indx in range(istart, iend+1):
15401540
_ = ax.plot(10.0**pcaflux['newloglam'],
1541-
pcaflux['newflux'][l, :] + separation*(l % nfluxes),
1542-
colorvec[l % len(colorvec)]+'-',
1541+
pcaflux['newflux'][indx, :] + separation*(indx % nfluxes),
1542+
colorvec[indx % len(colorvec)]+'-',
15431543
linewidth=1)
15441544
_ = ax.set_xlabel(r'Wavelength [Å]')
15451545
_ = ax.set_ylabel(r'Flux [$\mathsf{10^{-17} erg\, cm^{-2} s^{-1} \AA^{-1}}$] + Constant')

pydl/pydlspec2d/spec2d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,18 @@ def aesthetics(flux, invvar, method='traditional'):
4646
goodpts = invvar > 0
4747
newflux[~goodpts] = newflux[goodpts].mean()
4848
elif method == 'damp':
49-
l = 250 # damping length in pixels
49+
damp_len = 250 # damping length in pixels
5050
goodpts = invvar.nonzero()[0]
5151
nflux = flux.size
5252
mingood = goodpts.min()
5353
maxgood = goodpts.max()
5454
newflux = djs_maskinterp(flux, invvar == 0, const=True)
5555
pixels = np.arange(nflux, dtype='f')
5656
if mingood > 0:
57-
damp1 = float(min(mingood, l))
57+
damp1 = float(min(mingood, damp_len))
5858
newflux *= 0.5*(1.0+erf((pixels-mingood)/damp1))
5959
if maxgood < (nflux - 1):
60-
damp2 = float(min(maxgood, l))
60+
damp2 = float(min(maxgood, damp_len))
6161
newflux *= 0.5*(1.0+erf((maxgood-pixels)/damp2))
6262
elif method == 'nothing':
6363
newflux = flux.copy()

pydl/pydlspec2d/tests/test_spec1d.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ def test_template_metadata():
104104

105105

106106
def test_wavevector():
107-
l = wavevector(3, 4, binsz=0.1)
108-
ll = np.array([3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0])
109-
assert np.allclose(l, ll)
110-
l = wavevector(3, 4, wavemin=3, binsz=0.1)
111-
ll = np.array([3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0])
112-
assert np.allclose(l, ll)
107+
w = wavevector(3, 4, binsz=0.1)
108+
ww = np.array([3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0])
109+
assert np.allclose(w, ww)
110+
w = wavevector(3, 4, wavemin=3, binsz=0.1)
111+
ww = np.array([3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0])
112+
assert np.allclose(w, ww)

pydl/pydlutils/bspline.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,10 @@ def bsplvn(self, x, ileft):
334334
imj = ileft-j
335335
deltam[:, j] = x - bkpt[imj]
336336
vmprev = 0.0
337-
for l in range(j+1):
338-
vm = vnikx[:, l]/(deltap[:, l] + deltam[:, j-l])
339-
vnikx[:, l] = vm*deltap[:, l] + vmprev
340-
vmprev = vm*deltam[:, j-l]
337+
for k in range(j+1):
338+
vm = vnikx[:, k]/(deltap[:, k] + deltam[:, j-k])
339+
vnikx[:, k] = vm*deltap[:, k] + vmprev
340+
vmprev = vm*deltam[:, j-k]
341341
j += 1
342342
vnikx[:, j] = vmprev
343343
return vnikx
@@ -451,7 +451,7 @@ def maskpoints(self, err):
451451
return -2
452452

453453

454-
def cholesky_band(l, mininf=0.0):
454+
def cholesky_band(low, mininf=0.0):
455455
"""Compute *lower* Cholesky decomposition of a banded matrix.
456456
457457
This function provides informative error messages to pass back to the
@@ -460,15 +460,15 @@ def cholesky_band(l, mininf=0.0):
460460
461461
Parameters
462462
----------
463-
l : :class:`numpy.ndarray`
463+
low : :class:`numpy.ndarray`
464464
A matrix on which to perform the Cholesky decomposition. The
465465
matrix must be in a special, *lower* form described in
466466
:func:`scipy.linalg.cholesky_banded`. In addition, the input
467467
must be padded. If the original, square matrix has size
468468
:math:`N \\times N`, and the width of the band is :math:`b`,
469-
`l` must be :math:`b \\times (N + b)`.
469+
`low` must be :math:`b \\times (N + b)`.
470470
mininf : :class:`float`, optional
471-
Entries in the `l` matrix are considered negative if they are less
471+
Entries in the `low` matrix are considered negative if they are less
472472
than this value (default 0.0).
473473
474474
Returns
@@ -479,19 +479,19 @@ def cholesky_band(l, mininf=0.0):
479479
be the input matrix. If no problems were detected, the first item
480480
will be -1, and the second item will be the Cholesky decomposition.
481481
"""
482-
bw, nn = l.shape
482+
bw, nn = low.shape
483483
n = nn - bw
484-
negative = l[0, 0:n] <= mininf
485-
if negative.any() or not np.all(np.isfinite(l)):
484+
negative = low[0, 0:n] <= mininf
485+
if negative.any() or not np.all(np.isfinite(low)):
486486
warn('Bad entries: ' + str(negative.nonzero()[0]), PydlutilsUserWarning)
487-
return (negative.nonzero()[0], l)
487+
return (negative.nonzero()[0], low)
488488
try:
489-
lower = cholesky_banded(l[:, 0:n], lower=True)
489+
lower = cholesky_banded(low[:, 0:n], lower=True)
490490
except LinAlgError:
491491
#
492492
# Figure out where the error is.
493493
#
494-
lower = l.copy()
494+
lower = low.copy()
495495
kn = bw - 1
496496
spot = np.arange(kn, dtype='i4') + 1
497497
for j in range(n):
@@ -500,11 +500,11 @@ def cholesky_band(l, mininf=0.0):
500500
x = lower[spot, j]
501501
if not np.all(np.isfinite(x)):
502502
warn('NaN found in cholesky_band.', PydlutilsUserWarning)
503-
return (j, l)
503+
return (j, low)
504504
#
505505
# Restore padding.
506506
#
507-
L = np.zeros(l.shape, dtype=l.dtype)
507+
L = np.zeros(low.shape, dtype=low.dtype)
508508
L[:, 0:n] = lower
509509
return (-1, L)
510510

pydl/pydlutils/mangle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ def read_mangle_polygons(filename):
677677
with open(filename, 'r') as ply:
678678
# lines = ply.read().split(ply.newlines)
679679
lines = ply.readlines()
680-
lines = [l.strip() for l in lines]
680+
lines = [ln.strip() for ln in lines]
681681
try:
682682
_ = int(lines[0].strip().split()[0])
683683
except ValueError:

pydl/pydlutils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def struct_print(array, filename=None, formatcodes=None, alias=None,
374374
rowformat = (colstart + colsep.join([formatcodes[tag]
375375
for tag in array.dtype.names]) + colend)
376376
for k in range(array.size):
377-
lines.append(rowformat.format(*([decode_mixed(l) for l in array[k].tolist()])))
377+
lines.append(rowformat.format(*([decode_mixed(ll) for ll in array[k].tolist()])))
378378
if html:
379379
lines.append('</table>')
380380
f = None # This variable will store a file handle

pydl/pydlutils/sdss.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,21 +170,21 @@ def sdss_flagexist(flagname, bitname, flagexist=False, whichexist=False):
170170
bitnames = [bitname.upper()]
171171
else:
172172
bitnames = [b.upper() for b in bitname]
173-
f = False
174-
l = False
173+
flexist = False
174+
allexist = False
175175
which = [False] * len(bitnames)
176176
if flagname.upper() in maskbits:
177-
f = True
177+
flexist = True
178178
which = [n in maskbits[flagname.upper()] for n in bitnames]
179-
l = sum(which) == len(which)
179+
allexist = sum(which) == len(which)
180180
if flagexist and whichexist:
181-
return (l, f, which)
181+
return (allexist, flexist, which)
182182
elif flagexist:
183-
return (l, f)
183+
return (allexist, flexist)
184184
elif whichexist:
185-
return (l, which)
185+
return (allexist, which)
186186
else:
187-
return l
187+
return allexist
188188

189189

190190
def sdss_flagname(flagname, flagvalue, concat=False):

pydl/pydlutils/spheregroup.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,29 +291,29 @@ def friendsoffriends(self, ra, dec, linkSep):
291291
chunkGroup = self.chunkfriendsoffriends(ra, dec, self.chunkList[i][j], linkSep)
292292
for k in range(chunkGroup.nGroups):
293293
minEarly = 9*nPoints
294-
l = chunkGroup.firstGroup[k]
295-
while l != -1:
296-
if inGroup[self.chunkList[i][j][l]] != -1:
297-
checkEarly = inGroup[self.chunkList[i][j][l]]
294+
ll = chunkGroup.firstGroup[k]
295+
while ll != -1:
296+
if inGroup[self.chunkList[i][j][ll]] != -1:
297+
checkEarly = inGroup[self.chunkList[i][j][ll]]
298298
while mapGroups[checkEarly] != checkEarly:
299299
checkEarly = mapGroups[checkEarly]
300300
minEarly = min(minEarly, checkEarly)
301301
else:
302-
inGroup[self.chunkList[i][j][l]] = nMapGroups
303-
l = chunkGroup.nextGroup[l]
302+
inGroup[self.chunkList[i][j][ll]] = nMapGroups
303+
ll = chunkGroup.nextGroup[ll]
304304
if minEarly == 9*nPoints:
305305
mapGroups[nMapGroups] = nMapGroups
306306
else:
307307
mapGroups[nMapGroups] = minEarly
308-
l = chunkGroup.firstGroup[k]
309-
while l != -1:
310-
checkEarly = inGroup[self.chunkList[i][j][l]]
308+
ll = chunkGroup.firstGroup[k]
309+
while ll != -1:
310+
checkEarly = inGroup[self.chunkList[i][j][ll]]
311311
while mapGroups[checkEarly] != checkEarly:
312312
tmpEarly = mapGroups[checkEarly]
313313
mapGroups[checkEarly] = minEarly
314314
checkEarly = tmpEarly
315315
mapGroups[checkEarly] = minEarly
316-
l = chunkGroup.nextGroup[l]
316+
ll = chunkGroup.nextGroup[ll]
317317
nMapGroups += 1
318318
#
319319
# Now all groups which are mapped to themselves are the real groups

pydl/pydlutils/tests/test_bspline.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def test_cholesky_band():
8181
ab = np.array([[8., 9., 10., 11., 12., 13., 14., 0., 0., 0.],
8282
[1., 2., 3., 4., 5., 6., 0., 0., 0., 0.],
8383
[1., 2., 3., 4., 5., 0., 0., 0., 0., 0.]])
84-
l = np.array([[2.82842712, 2.97909382, 3.07877788, 3.1382224, 3.16559183, 3.16295604, 3.12782377, 0., 0., 0.],
85-
[0.35355339, 0.62938602, 0.8371714, 1.01466666, 1.17093392, 1.31223108, 0., 0., 0., 0.],
86-
[0.35355339, 0.67134509, 0.97441261, 1.27460692, 1.57948348, 0., 0., 0., 0., 0.]])
84+
low = np.array([[2.82842712, 2.97909382, 3.07877788, 3.1382224, 3.16559183, 3.16295604, 3.12782377, 0., 0., 0.],
85+
[0.35355339, 0.62938602, 0.8371714, 1.01466666, 1.17093392, 1.31223108, 0., 0., 0., 0.],
86+
[0.35355339, 0.67134509, 0.97441261, 1.27460692, 1.57948348, 0., 0., 0., 0., 0.]])
8787
i, ll = cholesky_band(ab)
88-
assert np.allclose(l, ll)
88+
assert np.allclose(low, ll)
8989
ab[0, 0] = 1.0e-6
9090
with pytest.warns(PydlutilsUserWarning) as w:
9191
i, ll = cholesky_band(ab, mininf=1.0e-5)
@@ -99,10 +99,10 @@ def test_cholesky_band():
9999

100100

101101
def test_cholesky_solve():
102-
l = np.array([[2.82842712, 2.97909382, 3.07877788, 3.1382224, 3.16559183, 3.16295604, 3.12782377, 0., 0., 0.],
102+
a = np.array([[2.82842712, 2.97909382, 3.07877788, 3.1382224, 3.16559183, 3.16295604, 3.12782377, 0., 0., 0.],
103103
[0.35355339, 0.62938602, 0.8371714, 1.01466666, 1.17093392, 1.31223108, 0., 0., 0., 0.],
104104
[0.35355339, 0.67134509, 0.97441261, 1.27460692, 1.57948348, 0., 0., 0., 0., 0.]])
105-
b = np.ones((10,), dtype=l.dtype)
105+
bb = np.ones((10,), dtype=a.dtype)
106106
xx = np.array([0.10848432, 0.07752049, 0.05460496, 0.04231068, 0.02116434, 0.03276732, 0.04982674, 0., 0., 0.])
107-
x = cholesky_solve(l, b)
107+
x = cholesky_solve(a, bb)
108108
assert np.allclose(x, xx)

0 commit comments

Comments
 (0)