Skip to content

Commit

Permalink
[ci] sherpa: activate env because gh-actions forgets; xspec: fix bug …
Browse files Browse the repository at this point in the history
…with new numpy (np.int)
  • Loading branch information
JohannesBuchner committed Oct 21, 2023
1 parent 5a148f6 commit 8e5aef9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
45 changes: 27 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ jobs:
pip install --no-cache-dir h5py
- name: Conda info
run: conda info
run: |
conda activate ciao
conda info
- name: Conda list
run: conda list
run: |
conda activate ciao
conda list
- name: Conda paths
run: |
pwd
Expand Down Expand Up @@ -122,6 +126,7 @@ jobs:
- name: Test helper scripts
run: |
conda activate ciao
pushd docker/testsrc
python -m coverage run -p ../../fixkeywords.py combined_src.pi combined_bkg.pi combined_src.rmf combined_src.arf
python -m coverage run -p ../../gal.py combined_src.pi
Expand All @@ -136,33 +141,37 @@ jobs:
- name: Test examples
run: |
pushd examples/sherpa;
# install interpolation code first
echo $CONDA_PREFIX/lib/python*
ls /usr/include/numpy/ || true
sudo ln -s $CONDA_PREFIX/lib/python${{ matrix.python-version }}/site-packages/numpy/core/include/numpy /usr/include/numpy
ls /usr/include/numpy/;
git clone https://github.com/JohannesBuchner/npyinterp.git;
pushd npyinterp; make; popd;
# run examples
PYTHONPATH=../../:${PYTHONPATH}:npyinterp/ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:npyinterp/ bash -v runall.sh || exit 1;
popd;
conda activate ciao
pushd examples/sherpa;
# install interpolation code first
echo $CONDA_PREFIX/lib/python*
ls /usr/include/numpy/ || true
sudo ln -s $CONDA_PREFIX/lib/python${{ matrix.python-version }}/site-packages/numpy/core/include/numpy /usr/include/numpy
ls /usr/include/numpy/;
git clone https://github.com/JohannesBuchner/npyinterp.git;
pushd npyinterp; make; popd;
# run examples
PYTHONPATH=../../:${PYTHONPATH}:npyinterp/ LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:npyinterp/ bash -v runall.sh || exit 1;
popd;
- name: Run XAGNFitter
run: |
pushd examples/sherpa/chandra;
echo "179.pi 0.5 8" > filenames.txt
PYTHONPATH=../../../:$PYTHONPATH WITHAPEC=0 coverage run -p ../xagnfitter.py || exit 1;
ls;
popd;
conda activate ciao
pushd examples/sherpa/chandra;
echo "179.pi 0.5 8" > filenames.txt
PYTHONPATH=../../../:$PYTHONPATH WITHAPEC=0 coverage run -p ../xagnfitter.py || exit 1;
ls;
popd;
- name: Install
run: |
conda activate ciao
python -m pip -y install . --user
wc -l examples/sherpa/.cover* examples/xspec/.cover* docker/testsrc/.cover* .cover* || true
- name: Coverage report
run: |
conda activate ciao
python -m coverage combine examples/sherpa examples/xspec docker/testsrc .
python -m coverage report
coverage-lcov
Expand Down
2 changes: 1 addition & 1 deletion bxa/xspec/sinning.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def binning(outputfiles_basename, bins, widths, data, models, nmin=20):
#exp(numpy.log(stats[stats[:,0] == n][:,2]).sum()) * (stats[:,0] == n).sum()
# for n in sorted(set(stats[:,0]))]))
nstats = stats[stats[:,0] == n]
pxlo = xlo[(nstats[:,1] * n).astype(numpy.int)]
pxlo = xlo[(nstats[:,1] * n).astype(int)]
pxhi = numpy.asarray(pxlo[1:].tolist() + [xdata.max()])

# so far so good.
Expand Down

0 comments on commit 8e5aef9

Please sign in to comment.