Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
pip install -e ./flex
- name: Test with pytest
run: |
coverage run -m pytest -v -s
coverage run -m pytest -v -s
- name: Upload coverage to Coveralls
run: coveralls --service=github
env:
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = --ignore=flex
32 changes: 16 additions & 16 deletions src/discmodel/discmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,26 @@ def rotate_disc(self,xrotation=0.,yrotation=0.,zrotation=0.,euler=False):
# do the transformation in position
tmp = np.dot(np.array([x,y,z]).T,Rmatrix)

try:
xout = tmp[:,0]
yout = tmp[:,1]
zout = tmp[:,2]
except:
xout = tmp[0]
yout = tmp[1]
zout = tmp[2]
#try:
xout = tmp[:,0]
yout = tmp[:,1]
zout = tmp[:,2]
#except:
# xout = tmp[0]
# yout = tmp[1]
# zout = tmp[2]

# and in velocity
Comment thread
michael-petersen marked this conversation as resolved.
tmpv = np.dot(np.array([u,v,w]).T,Rmatrix)

try:
uout = tmpv[:,0]
vout = tmpv[:,1]
wout = tmpv[:,2]
except:
uout = tmpv[0]
vout = tmpv[1]
wout = tmpv[2]
#try:
uout = tmpv[:,0]
vout = tmpv[:,1]
wout = tmpv[:,2]
#except:
# uout = tmpv[0]
# vout = tmpv[1]
# wout = tmpv[2]
Comment thread
michael-petersen marked this conversation as resolved.
Comment thread
michael-petersen marked this conversation as resolved.

self.x = xout
self.y = yout
Expand Down
2 changes: 1 addition & 1 deletion src/discmodel/optional_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def _check_lintsampler():
def _check_flex():
try:
import importlib
importlib.import_module("lintsampler")
importlib.import_module("flex")
return True
except ImportError:
return False
Expand Down
10 changes: 8 additions & 2 deletions tests/test_discmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def test_discmodel_expansion():
nbins = 50

disc = discmodel.DiscGalaxy(N=N, a=a, M=M, vcirc=vcirc, rmax=rmax)

# try to compute expansion before image - should raise error

disc.generate_image(rmax,nbins,noiselevel=noiselevel)

# add some noise
Expand All @@ -132,9 +135,12 @@ def test_discmodel_expansion():
# compute the expansion
E1 = disc.make_expansion(mmax=4,nmax=4,rscl=1.0,xmax=rmax,noisy=False)

# compute a noisy expansion
E2 = disc.make_expansion(mmax=4,nmax=4,rscl=1.0,xmax=rmax,noisy=True)
assert E2 is not None
# compute the expansion from the particles
E2 = disc.make_particle_expansion(mmax=4,nmax=4,rscl=1.0)

E3 = disc.make_particle_expansion(mmax=4,nmax=4,rscl=1.0)
assert E3 is not None
# compute A1
a1 = disc.compute_a1(E1)

Expand Down