Skip to content

Commit

Permalink
make h5py import optional
Browse files Browse the repository at this point in the history
  • Loading branch information
weninc committed Nov 7, 2023
1 parent 0ecc6ea commit 8bb6ffc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 0 additions & 7 deletions azint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ void generate_matrix(const Poni& poni,
for (int k=0; k<n_splitting; k++) {
float delta1 = (k + 0.5) / n_splitting;
for (int l=0; l<n_splitting; l++) {
/*
float p[] = {
(i + (k + 0.5f) / n_splitting) * pixel_size - poni.poni1,
(j + (l + 0.5f) / n_splitting) * pixel_size - poni.poni2,
poni.dist
};
*/
float delta2 = (l + 0.5) / n_splitting;
float p[] = {
A1 + delta1 * BA1 + delta2 * DA1 - poni.poni1,
Expand Down
7 changes: 6 additions & 1 deletion azint/detector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import h5py
try:
import h5py
except ImportError:
h5py = None
import numpy as np

'''
Expand Down Expand Up @@ -48,6 +51,8 @@ def get_pixel_corners(self, pixel1, pixel2, shape):

class NexusDetector(Detector):
def __init__(self, filename):
if not h5py:
raise RuntimeError('h5py module missing: NexusDetector is not supported')

def find_det(name, item):
if item.attrs.get('NX_class') == 'NXdetector':
Expand Down

0 comments on commit 8bb6ffc

Please sign in to comment.