Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/nipyPublic

Commitee5b25e

Browse files
authored
Merge pull request#578 from DimitriPapadopoulos/C4
Apply ruff/flake8-comprehensions preview rules (C4)
2 parents3ef4a6f +c2be7cf commitee5b25e

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

‎doc/users/plots/hrf_different.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
ta= [0,4,8,12,16];tb= [2,6,10,14,18]
1818
ba=1;bb=-2
19-
na=ba*sum([glover.subs(T,T-t)fortinta])
20-
nb=bb*sum([afni.subs(T,T-t)fortintb])
19+
na=ba*sum(glover.subs(T,T-t)fortinta)
20+
nb=bb*sum(afni.subs(T,T-t)fortintb)
2121

2222
nav=lambdify_t(na)
2323
nbv=lambdify_t(nb)

‎doc/users/plots/neuronal_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
ta= [0,4,8,12,16];tb= [2,6,10,14,18]
1616
ba=Symbol('ba');bb=Symbol('bb');t=Symbol('t')
17-
fa=sum([Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t>=_t+0.5)))for_tinta])*ba
18-
fb=sum([Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t>=_t+0.5)))for_tintb])*bb
17+
fa=sum(Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t>=_t+0.5)))for_tinta)*ba
18+
fb=sum(Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t>=_t+0.5)))for_tintb)*bb
1919
N=fa+fb
2020

2121
Nn=N.subs(ba,1)

‎doc/users/plots/neuronal_event.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
ba=Symbol('ba')
1515
bb=Symbol('bb')
1616
t=Symbol('t')
17-
fa=sum([Heaviside(t-_t)for_tinta])*ba
18-
fb=sum([Heaviside(t-_t)for_tintb])*bb
17+
fa=sum(Heaviside(t-_t)for_tinta)*ba
18+
fb=sum(Heaviside(t-_t)for_tintb)*bb
1919
N=fa+fb
2020

2121
Nn=N.subs(ba,1)

‎nipy/algorithms/registration/tests/test_histogram_registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_set_fov():
203203
R=HistogramRegistration(I,J)
204204
R.set_fov(npoints=np.prod(I.shape))
205205
assertR._from_data.shape==I.shape
206-
half_shape=tuple([I.shape[i]/2foriinrange(3)])
206+
half_shape=tuple(I.shape[i]/2foriinrange(3))
207207
R.set_fov(spacing=(2,2,2))
208208
assertR._from_data.shape==half_shape
209209
R.set_fov(corner=half_shape)

‎nipy/algorithms/statistics/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def cube_with_strides_center(center=[0,0,0],
218218
forminmaximal:
219219
nm= [vertices[j]forjinm]
220220
mm.append(nm)
221-
maximal= [tuple([vertices[j]forjinm])forminmaximal]
221+
maximal= [tuple(vertices[j]forjinm)forminmaximal]
222222
returncomplex(maximal)
223223

224224

‎nipy/core/reference/array_coords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def from_shape(coordmap, shape):
183183
are 'array' coordinates.
184184
185185
"""
186-
slices=tuple([slice(0,s,1)forsinshape])
186+
slices=tuple(slice(0,s,1)forsinshape)
187187
returnGrid(coordmap)[slices]
188188

189189
def__repr__(self):

‎nipy/core/reference/slices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ def bounding_box(coordmap, shape):
222222
((2.0, 31.0), (4.0, 121.0), (6.0, 101.0))
223223
"""
224224
e=ArrayCoordMap.from_shape(coordmap,shape)
225-
returntuple([(r.min(),r.max())forrine.transposed_values])
225+
returntuple((r.min(),r.max())forrine.transposed_values)

‎nipy/io/tests/test_save.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_save3(in_tmp_path):
8585
data=tmp.get_fdata().copy()
8686
img2=api.Image(data,tmp.coordmap,tmp.metadata)
8787
deltmp
88-
asserttuple([img.shape[l]forlin [3,2,1,0]])==img2.shape
88+
asserttuple(img.shape[l]forlin [3,2,1,0])==img2.shape
8989
a=np.transpose(img.get_fdata(), [3,2,1,0])
9090
assertnotnp.allclose(img.affine,img2.affine)
9191
assertnp.allclose(a,img2.get_fdata())

‎nipy/labs/tests/test_statistical_mapping.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ def test_6():
5353
img=make_surrogate_data()
5454
clusters,info=cluster_stats(img,img,height_th=.05,
5555
height_control='fdr',cluster_th=0,nulls={})
56-
print(len(clusters),sum([c['size']forcinclusters]))
56+
print(len(clusters),sum(c['size']forcinclusters))
5757
assertlen(clusters)==4
5858

5959
deftest7():
6060
img=make_surrogate_data()
6161
clusters,info=cluster_stats(img,img,height_th=3.,height_control='None',cluster_th=0,nulls={})
62-
nstv=sum([c['size']forcinclusters])
62+
nstv=sum(c['size']forcinclusters)
6363
assertnstv==36
6464

6565
deftest_8():
6666
img=make_surrogate_data()
6767
clusters,info=cluster_stats(img,img,height_th=.001,height_control='fpr',cluster_th=0,nulls={})
68-
nstv=sum([c['size']forcinclusters])
68+
nstv=sum(c['size']forcinclusters)
6969
assertnstv==36

‎nipy/modalities/fmri/tests/test_glm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def test_glm_ar():
166166
mulm,n,p,q=ar1_glm()
167167
assertlen(mulm.labels_)==n
168168
assertlen(mulm.results_)>1
169-
tmp=sum([mulm.results_[key].theta.shape[1]
170-
forkeyinmulm.results_])
169+
tmp=sum(mulm.results_[key].theta.shape[1]
170+
forkeyinmulm.results_)
171171
asserttmp==n
172172

173173

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp