Skip to content
Open
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
6 changes: 3 additions & 3 deletions pyCHX/Two_Time_Correlation_Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def get_qedge2(qstart, qend, qwidth, noqs, return_int=False):
if not return_int:
return qedge, qcenter
else:
return np.int(qedge), np.int(qcenter)
return int(qedge), int(qcenter)


def get_qedge(qstart, qend, qwidth, noqs, return_int=False):
Expand All @@ -308,7 +308,7 @@ def get_qedge(qstart, qend, qwidth, noqs, return_int=False):
if not return_int:
return qedge, qcenter
else:
return np.int(qedge), np.int(qcenter)
return int(qedge), int(qcenter)


def get_time_edge(tstart, tend, twidth, nots, return_int=False):
Expand All @@ -328,7 +328,7 @@ def get_time_edge(tstart, tend, twidth, nots, return_int=False):
if not return_int:
return tedge, tcenter
else:
return np.int(tedge), np.int(tcenter)
return int(tedge), int(tcenter)


def rotate_g12q_to_rectangle(g12q):
Expand Down
2 changes: 1 addition & 1 deletion pyCHX/chx_compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def para_segment_compress_eigerdata(
print("It will create %i temporary files for parallel compression." % Nf)

if Nf > num_max_para_process:
N_runs = np.int(np.ceil(Nf / float(num_max_para_process)))
N_runs = int(np.ceil(Nf / float(num_max_para_process)))
print("The parallel run number: %s is larger than num_max_para_process: %s" % (Nf, num_max_para_process))
else:
N_runs = 1
Expand Down
2 changes: 1 addition & 1 deletion pyCHX/chx_crosscor.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def fftconvolve_new(in1, in2, mode="full"):

s1 = array(in1.shape)
s2 = array(in2.shape)
complex_result = np.issubdtype(in1.dtype, np.complex) or np.issubdtype(in2.dtype, np.complex)
complex_result = np.issubdtype(in1.dtype, complex) or np.issubdtype(in2.dtype, complex)
shape = s1 + s2 - 1

if mode == "valid":
Expand Down
2 changes: 1 addition & 1 deletion pyCHX/chx_generic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,7 @@ def get_series_g2_taus(fra_max_list, acq_time=1, max_fra_num=None, log_taus=True
if max_fra_num != None:
L = max_fra_num
else:
L = np.infty
L = np.inf
if n > L:
warnings.warn(
"Warning: the dose value is too large, and please"
Expand Down
2 changes: 1 addition & 1 deletion pyCHX/chx_speckle.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def xsvs(
num_pixels = np.bincount(labels, minlength=(num_roi + 1))[1:]

# probability density of detecting photons
prob_k_all = np.zeros([num_times, num_roi], dtype=np.object)
prob_k_all = np.zeros([num_times, num_roi], dtype=object)

# square of probability density of detecting photons
prob_k_pow_all = np.zeros_like(prob_k_all)
Expand Down
30 changes: 15 additions & 15 deletions pyCHX/chx_specklecp.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def xsvsp_single(
# print(time_bin)
# number of times in the time bin
num_times = len(time_bin)
prob_k = np.zeros([num_times, num_roi], dtype=np.object)
prob_k = np.zeros([num_times, num_roi], dtype=object)
prob_k_std_dev = np.zeros_like(prob_k)
his_sum = np.zeros([num_times, num_roi])
# print( len(res) )
Expand Down Expand Up @@ -430,7 +430,7 @@ def xsvsc_single(
# number of pixels per ROI
num_pixels = np.bincount(labels, minlength=(num_roi + 1))[1:]
# probability density of detecting photons
prob_k = np.zeros([num_times, num_roi], dtype=np.object)
prob_k = np.zeros([num_times, num_roi], dtype=object)
his_sum = np.zeros([num_times, num_roi])
# square of probability density of detecting photons
prob_k_pow = np.zeros_like(prob_k)
Expand Down Expand Up @@ -706,9 +706,9 @@ def get_his_std(data_pixel, rois, max_cts=None):
max_cts = np.max(data_pixel) + 1
qind, pixelist = roi.extract_label_indices(rois)
noqs = len(np.unique(qind))
his = np.zeros([noqs], dtype=np.object)
std = np.zeros_like(his, dtype=np.object)
kmean = np.zeros_like(his, dtype=np.object)
his = np.zeros([noqs], dtype=object)
std = np.zeros_like(his, dtype=object)
kmean = np.zeros_like(his, dtype=object)
for qi in range(noqs):
pixelist_qi = np.where(qind == qi + 1)[0]
# print(qi, max_cts)
Expand Down Expand Up @@ -779,10 +779,10 @@ def get_binned_his_std_qi(data_pixel_qi, lag_steps, max_cts=None):
lag_steps = np.array(lag_steps)
lag_steps = lag_steps[np.nonzero(lag_steps)]
nologs = len(lag_steps)
his = np.zeros([nologs], dtype=np.object)
bins = np.zeros_like(his, dtype=np.object)
std = np.zeros_like(his, dtype=np.object)
kmean = np.zeros_like(his, dtype=np.object)
his = np.zeros([nologs], dtype=object)
bins = np.zeros_like(his, dtype=object)
std = np.zeros_like(his, dtype=object)
kmean = np.zeros_like(his, dtype=object)
i = 0
for lag in lag_steps:
data_pixel_qi_ = np.sum(reshape_array(data_pixel_qi, lag), axis=1)
Expand Down Expand Up @@ -813,10 +813,10 @@ def get_binned_his_std(data_pixel, rois, lag_steps, max_cts=None):
lag_steps = lag_steps[np.nonzero(lag_steps)]

nologs = len(lag_steps)
his = np.zeros([nologs, noqs], dtype=np.object)
bins = np.zeros([nologs], dtype=np.object)
std = np.zeros_like(his, dtype=np.object)
kmean = np.zeros_like(his, dtype=np.object)
his = np.zeros([nologs, noqs], dtype=object)
bins = np.zeros([nologs], dtype=object)
std = np.zeros_like(his, dtype=object)
kmean = np.zeros_like(his, dtype=object)
i = 0
for lag in tqdm(lag_steps):
data_pixel_ = np.sum(reshape_array(data_pixel, lag), axis=1)
Expand Down Expand Up @@ -1351,8 +1351,8 @@ def get_his_std_from_pds(spec_pds, his_shapes=None):
if his_shapes is None:
M, N = 2, int((len(spkeys) - 1) / 4)
# print(M,N)
spec_his = np.zeros([M, N], dtype=np.object)
spec_std = np.zeros([M, N], dtype=np.object)
spec_his = np.zeros([M, N], dtype=object)
spec_std = np.zeros([M, N], dtype=object)
for i in range(M):
for j in range(N):
spec_his[i, j] = np.array(spec_pds[spkeys[1 + i * N + j]][~np.isnan(spec_pds[spkeys[1 + i * N + j]])])
Expand Down
6 changes: 3 additions & 3 deletions pyCHX/v2/_commonspeckle/Two_Time_Correlation_Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def get_qedge2(qstart, qend, qwidth, noqs, return_int=False):
if not return_int:
return qedge, qcenter
else:
return np.int(qedge), np.int(qcenter)
return int(qedge), int(qcenter)


def get_qedge(qstart, qend, qwidth, noqs, return_int=False):
Expand All @@ -308,7 +308,7 @@ def get_qedge(qstart, qend, qwidth, noqs, return_int=False):
if not return_int:
return qedge, qcenter
else:
return np.int(qedge), np.int(qcenter)
return int(qedge), int(qcenter)


def get_time_edge(tstart, tend, twidth, nots, return_int=False):
Expand All @@ -328,7 +328,7 @@ def get_time_edge(tstart, tend, twidth, nots, return_int=False):
if not return_int:
return tedge, tcenter
else:
return np.int(tedge), np.int(tcenter)
return int(tedge), int(tcenter)


def rotate_g12q_to_rectangle(g12q):
Expand Down
10 changes: 5 additions & 5 deletions pyCHX/v2/_commonspeckle/chx_compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ def read_compressed_eigerdata(
CAL = True
if CAL:
FD = Multifile(filename, beg, end)
imgsum = np.zeros(FD.end - FD.beg, dtype=np.float)
avg_img = np.zeros([FD.md["ncols"], FD.md["nrows"]], dtype=np.float)
imgsum = np.zeros(FD.end - FD.beg, dtype=float)
avg_img = np.zeros([FD.md["ncols"], FD.md["nrows"]], dtype=float)
imgsum, bad_frame_list_ = get_each_frame_intensityc(
FD,
sampling=1,
Expand Down Expand Up @@ -461,7 +461,7 @@ def para_segment_compress_eigerdata(
print("It will create %i temporary files for parallel compression." % Nf)

if Nf > num_max_para_process:
N_runs = np.int(np.ceil(Nf / float(num_max_para_process)))
N_runs = int(np.ceil(Nf / float(num_max_para_process)))
print("The parallel run number: %s is larger than num_max_para_process: %s" % (Nf, num_max_para_process))
else:
N_runs = 1
Expand Down Expand Up @@ -544,7 +544,7 @@ def segment_compress_eigerdata(

Nimg_ = len(images)
M, N = images[0].shape
avg_img = np.zeros([M, N], dtype=np.float)
avg_img = np.zeros([M, N], dtype=float)
Nopix = float(avg_img.size)
n = 0
good_count = 0
Expand Down Expand Up @@ -791,7 +791,7 @@ def init_compress_eigerdata(
fp.write(Header)

Nimg_ = len(images)
avg_img = np.zeros_like(images[0], dtype=np.float)
avg_img = np.zeros_like(images[0], dtype=float)
Nopix = float(avg_img.size)
n = 0
good_count = 0
Expand Down
8 changes: 4 additions & 4 deletions pyCHX/v2/_commonspeckle/chx_correlationc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,14 +1530,14 @@ def get_data(self):
Return: 2-D array, shape as (len(images), len(pixellist))
"""

data_array = np.zeros([self.length, len(self.pixelist)], dtype=np.float)
data_array = np.zeros([self.length, len(self.pixelist)], dtype=float)
# fra_pix = np.zeros_like( pixelist, dtype=np.float64)
timg = np.zeros(self.FD.md["ncols"] * self.FD.md["nrows"], dtype=np.int32)
timg[self.pixelist] = np.arange(1, len(self.pixelist) + 1)

if self.norm_inten is not None:
# Mean_Int_Qind = np.array( self.qind.copy(), dtype=np.float)
Mean_Int_Qind = np.ones(len(self.qind), dtype=np.float)
Mean_Int_Qind = np.ones(len(self.qind), dtype=float)
noqs = len(np.unique(self.qind))
nopr = np.bincount(self.qind - 1)
noprs = np.concatenate([np.array([0]), np.cumsum(nopr)])
Expand Down Expand Up @@ -1645,14 +1645,14 @@ def get_data(self):
Return: 2-D array, shape as (len(images), len(pixellist))
"""

data_array = np.zeros([self.length, len(self.pixelist)], dtype=np.float)
data_array = np.zeros([self.length, len(self.pixelist)], dtype=float)
# fra_pix = np.zeros_like( pixelist, dtype=np.float64)
timg = np.zeros(self.FD.md["ncols"] * self.FD.md["nrows"], dtype=np.int32)
timg[self.pixelist] = np.arange(1, len(self.pixelist) + 1)

if self.mean_int_sets is not None:
# Mean_Int_Qind = np.array( self.qind.copy(), dtype=np.float)
Mean_Int_Qind = np.ones(len(self.qind), dtype=np.float)
Mean_Int_Qind = np.ones(len(self.qind), dtype=float)
noqs = len(np.unique(self.qind))
nopr = np.bincount(self.qind - 1)
noprs = np.concatenate([np.array([0]), np.cumsum(nopr)])
Expand Down
8 changes: 4 additions & 4 deletions pyCHX/v2/_commonspeckle/chx_generic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ def get_waxs_beam_center(gamma, origin=[432, 363], Ldet=1495, pixel_size=75 * 1e
beam center: for the target gamma, in pixel
"""
return [
np.int(origin[0] + np.tan(np.radians(gamma)) * Ldet / pixel_size),
int(origin[0] + np.tan(np.radians(gamma)) * Ldet / pixel_size),
origin[1],
]

Expand Down Expand Up @@ -2543,7 +2543,7 @@ def get_series_g2_taus(fra_max_list, acq_time=1, max_fra_num=None, log_taus=True
if max_fra_num is not None:
L = max_fra_num
else:
L = np.infty
L = np.inf
if n > L:
warnings.warn(
"Warning: the dose value is too large, and please"
Expand Down Expand Up @@ -2638,8 +2638,8 @@ def combine_images(filenames, outputfile, outsize=(2000, 2400)):
# nx = np.int( np.ceil( np.sqrt(N)) )
# ny = np.int( np.ceil( N / float(nx) ) )

ny = np.int(np.ceil(np.sqrt(N)))
nx = np.int(np.ceil(N / float(ny)))
ny = int(np.ceil(np.sqrt(N)))
nx = int(np.ceil(N / float(ny)))

# print(nx,ny)
result = Image.new("RGB", outsize, color=(255, 255, 255, 0))
Expand Down
2 changes: 1 addition & 1 deletion pyCHX/v2/_commonspeckle/chx_speckle.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def xsvs(
num_pixels = np.bincount(labels, minlength=(num_roi + 1))[1:]

# probability density of detecting photons
prob_k_all = np.zeros([num_times, num_roi], dtype=np.object)
prob_k_all = np.zeros([num_times, num_roi], dtype=object)

# square of probability density of detecting photons
prob_k_pow_all = np.zeros_like(prob_k_all)
Expand Down
30 changes: 15 additions & 15 deletions pyCHX/v2/_commonspeckle/chx_specklecp.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def xsvsp_single(
# print(time_bin)
# number of times in the time bin
num_times = len(time_bin)
prob_k = np.zeros([num_times, num_roi], dtype=np.object)
prob_k = np.zeros([num_times, num_roi], dtype=object)
prob_k_std_dev = np.zeros_like(prob_k)
his_sum = np.zeros([num_times, num_roi])
# print( len(res) )
Expand Down Expand Up @@ -441,7 +441,7 @@ def xsvsc_single(
# number of pixels per ROI
num_pixels = np.bincount(labels, minlength=(num_roi + 1))[1:]
# probability density of detecting photons
prob_k = np.zeros([num_times, num_roi], dtype=np.object)
prob_k = np.zeros([num_times, num_roi], dtype=object)
his_sum = np.zeros([num_times, num_roi])
# square of probability density of detecting photons
prob_k_pow = np.zeros_like(prob_k)
Expand Down Expand Up @@ -727,9 +727,9 @@ def get_his_std(data_pixel, rois, max_cts=None):
max_cts = np.max(data_pixel) + 1
qind, pixelist = roi.extract_label_indices(rois)
noqs = len(np.unique(qind))
his = np.zeros([noqs], dtype=np.object)
std = np.zeros_like(his, dtype=np.object)
kmean = np.zeros_like(his, dtype=np.object)
his = np.zeros([noqs], dtype=object)
std = np.zeros_like(his, dtype=object)
kmean = np.zeros_like(his, dtype=object)
for qi in range(noqs):
pixelist_qi = np.where(qind == qi + 1)[0]
# print(qi, max_cts)
Expand Down Expand Up @@ -800,10 +800,10 @@ def get_binned_his_std_qi(data_pixel_qi, lag_steps, max_cts=None):
lag_steps = np.array(lag_steps)
lag_steps = lag_steps[np.nonzero(lag_steps)]
nologs = len(lag_steps)
his = np.zeros([nologs], dtype=np.object)
bins = np.zeros_like(his, dtype=np.object)
std = np.zeros_like(his, dtype=np.object)
kmean = np.zeros_like(his, dtype=np.object)
his = np.zeros([nologs], dtype=object)
bins = np.zeros_like(his, dtype=object)
std = np.zeros_like(his, dtype=object)
kmean = np.zeros_like(his, dtype=object)
i = 0
for lag in lag_steps:
data_pixel_qi_ = np.sum(reshape_array(data_pixel_qi, lag), axis=1)
Expand Down Expand Up @@ -834,10 +834,10 @@ def get_binned_his_std(data_pixel, rois, lag_steps, max_cts=None):
lag_steps = lag_steps[np.nonzero(lag_steps)]

nologs = len(lag_steps)
his = np.zeros([nologs, noqs], dtype=np.object)
bins = np.zeros([nologs], dtype=np.object)
std = np.zeros_like(his, dtype=np.object)
kmean = np.zeros_like(his, dtype=np.object)
his = np.zeros([nologs, noqs], dtype=object)
bins = np.zeros([nologs], dtype=object)
std = np.zeros_like(his, dtype=object)
kmean = np.zeros_like(his, dtype=object)
i = 0
for lag in tqdm(lag_steps):
data_pixel_ = np.sum(reshape_array(data_pixel, lag), axis=1)
Expand Down Expand Up @@ -1390,8 +1390,8 @@ def get_his_std_from_pds(spec_pds, his_shapes=None):
if his_shapes is None:
M, N = 2, int((len(spkeys) - 1) / 4)
# print(M,N)
spec_his = np.zeros([M, N], dtype=np.object)
spec_std = np.zeros([M, N], dtype=np.object)
spec_his = np.zeros([M, N], dtype=object)
spec_std = np.zeros([M, N], dtype=object)
for i in range(M):
for j in range(N):
spec_his[i, j] = np.array(spec_pds[spkeys[1 + i * N + j]][~np.isnan(spec_pds[spkeys[1 + i * N + j]])])
Expand Down
6 changes: 3 additions & 3 deletions pyCHX/v2/_commonspeckle/xpcs_timepixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,15 @@ def init_compress_timepix_data(pos, t, binstep, filename, mask=None, md=None, no
)
fp.write(Header)

N_ = np.int(np.ceil((t.max() - t.min()) / binstep))
N_ = int(np.ceil((t.max() - t.min()) / binstep))
print("There are %s frames to be compressed..." % (N_ - 1))

ps, vs, cs = get_pvlist_from_post(pos, t, binstep, detx=md["sx"], dety=md["sy"])
N = len(cs) - 1 # the last one might don't have full number for bings, so kick off
css = np.cumsum(cs)
imgsum = np.zeros(N)
good_count = 0
avg_img = np.zeros([md["sy"], md["sx"]], dtype=np.float)
avg_img = np.zeros([md["sy"], md["sx"]], dtype=float)

for i in tqdm(range(0, N)):
if i == 0:
Expand Down Expand Up @@ -436,7 +436,7 @@ def init_compress_timepix_data_light_duty(
imgsum = np.zeros(N - 1)
print("There are %s frames to be compressed..." % (N - 1))
good_count = 0
avg_img = np.zeros([md["sy"], md["sx"]], dtype=np.float)
avg_img = np.zeros([md["sy"], md["sx"]], dtype=float)
for i in tqdm(range(N - 1)):
ind1 = np.argmin(np.abs(tx[i] - t))
ind2 = np.argmin(np.abs(tx[i + 1] - t))
Expand Down
2 changes: 1 addition & 1 deletion pyCHX/v2/_futurepyCHX/Create_Report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ def recursively_save_dict_contents_to_group(h5file, path, dic):
if not isinstance(key, str):
raise ValueError("dict keys must be strings to save to hdf5")
# save strings, numpy.int64, and numpy.float64 types
if isinstance(item, (np.int64, np.float64, str, np.float, float, np.float32, int)):
if isinstance(item, (np.int64, np.float64, str, float, float, np.float32, int)):
# print( 'here' )
h5file[path + key] = item
if not h5file[path + key].value == item:
Expand Down
Loading