LabTools3 1.1.3.13__tar.gz → 1.1.3.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/box.py +51 -14
- {labtools3-1.1.3.13 → labtools3-1.1.3.14/LabTools3.egg-info}/PKG-INFO +3 -1
- {labtools3-1.1.3.13/LabTools3.egg-info → labtools3-1.1.3.14}/PKG-INFO +3 -1
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/README.md +3 -1
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/setup.py +1 -1
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LICENSE +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/MCA.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/__init__.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/datafile.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/get_precision.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/parameterfile.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/pdatafile.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT/plotting.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT_Fit/__init__.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT_Fit/gen_fit.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT_Fit/linear_fit.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LT_Fit/parameters.py +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LabTools3.egg-info/SOURCES.txt +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LabTools3.egg-info/dependency_links.txt +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/LabTools3.egg-info/top_level.txt +0 -0
- {labtools3-1.1.3.13 → labtools3-1.1.3.14}/setup.cfg +0 -0
|
@@ -247,6 +247,8 @@ class histo:
|
|
|
247
247
|
title Set the title
|
|
248
248
|
xlabel Set the x-label
|
|
249
249
|
ylabel Set the y-label
|
|
250
|
+
calc_w2 If True calccultae the sum of the square of the weights for each bin to calculate the final bin error
|
|
251
|
+
weights Array of weight to increment the histogram with
|
|
250
252
|
============ =====================================================
|
|
251
253
|
|
|
252
254
|
Additional keyword arguments are passed to the :func:`numpy.histogram` function
|
|
@@ -265,8 +267,11 @@ class histo:
|
|
|
265
267
|
title = 'my histogram', \
|
|
266
268
|
xlabel = 'x-bin', \
|
|
267
269
|
ylabel = 'content', \
|
|
270
|
+
calc_w2 = False, \
|
|
268
271
|
**kwargs):
|
|
269
272
|
self.res = None
|
|
273
|
+
self.has_weights = 'weights' in kwargs
|
|
274
|
+
self.calc_w2 = calc_w2
|
|
270
275
|
self.fit_dict = {}
|
|
271
276
|
# initialize fitting
|
|
272
277
|
self.b0 = Parameter(0., 'b0')
|
|
@@ -342,10 +347,13 @@ class histo:
|
|
|
342
347
|
"""
|
|
343
348
|
if not add:
|
|
344
349
|
# a new filling
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
350
|
+
self.res = np.histogram(y, **kwargs)
|
|
351
|
+
if self.calc_w2 and self.has_weights:
|
|
352
|
+
w_loc = kwargs['weights']**2
|
|
353
|
+
# histogram with weights squared
|
|
354
|
+
kwargs1 = copy.copy(kwargs)
|
|
355
|
+
kwargs1['weights'] = w_loc
|
|
356
|
+
self.w2 = np.histogram(y, **kwargs1)[0] # save only the bin content
|
|
349
357
|
self.__setup_bins(error = None)
|
|
350
358
|
else:
|
|
351
359
|
# the bins have already been defined continue
|
|
@@ -353,12 +361,18 @@ class histo:
|
|
|
353
361
|
if self.res is None:
|
|
354
362
|
print("no binning information: try fill with add = False ")
|
|
355
363
|
return
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
364
|
+
|
|
365
|
+
res = np.histogram(y, bins = self.res[1], **kwargs)
|
|
366
|
+
if self.calc_w2 and self.has_weights:
|
|
367
|
+
w2 = kwargs['weights']**2
|
|
368
|
+
# histogram with weights squared
|
|
369
|
+
kwargs1 = copy.copy(kwargs)
|
|
370
|
+
kwargs1['weights'] = w2
|
|
371
|
+
w2 = np.histogram(y, **kwargs1)[0] # save only the bin content
|
|
360
372
|
# add the new bin content to the old one
|
|
361
373
|
self.res = (self.res[0] + res[0], self.res[1])
|
|
374
|
+
if self.calc_w2 and self.has_weights:
|
|
375
|
+
self.w2 += w2
|
|
362
376
|
# update the histogram information
|
|
363
377
|
self.__setup_bins(error = None)
|
|
364
378
|
# end of fill
|
|
@@ -1068,7 +1082,10 @@ class histo:
|
|
|
1068
1082
|
self.bin_content = self.res[0]
|
|
1069
1083
|
self.bins = self.res[1]
|
|
1070
1084
|
if error is None:
|
|
1071
|
-
self.
|
|
1085
|
+
if not self.has_weights: # no weights specified
|
|
1086
|
+
self.bin_error = np.sqrt(self.bin_content)
|
|
1087
|
+
elif self.calc_w2: # weights given and sum(weights**2) calculated for each bin
|
|
1088
|
+
self.bin_error = np.sqrt(self.w2)
|
|
1072
1089
|
else:
|
|
1073
1090
|
self.bin_error = error
|
|
1074
1091
|
self.__prepare_histo_plot()
|
|
@@ -1266,6 +1283,8 @@ class histo2d:
|
|
|
1266
1283
|
xlabel Set the x-label
|
|
1267
1284
|
ylabel Set the y-label
|
|
1268
1285
|
zlabel Set the z-label
|
|
1286
|
+
calc_w2 If True calccultae the sum of the square of the weights for each bin to calculate the final bin error
|
|
1287
|
+
weights Array of weight to increment the histogram with
|
|
1269
1288
|
colorbar if True, plot a colorbar
|
|
1270
1289
|
bad_color Set the color for plot for bins below zmin (default: w)
|
|
1271
1290
|
logz if True plot content on log scale
|
|
@@ -1292,10 +1311,13 @@ class histo2d:
|
|
|
1292
1311
|
bad_color = 'w',\
|
|
1293
1312
|
colorbar = True, \
|
|
1294
1313
|
logz = False,\
|
|
1314
|
+
calc_w2 = False,\
|
|
1295
1315
|
**kwargs):
|
|
1316
|
+
self.has_weights = 'weights' in kwargs
|
|
1296
1317
|
self.bad_color = bad_color # color for bad pixels
|
|
1297
1318
|
self.colorbar = colorbar
|
|
1298
1319
|
self.logz = logz
|
|
1320
|
+
self.calc_w2 = calc_w2
|
|
1299
1321
|
# initialize fitting
|
|
1300
1322
|
if (x_values is not None) and (y_values is not None):
|
|
1301
1323
|
# values have been given for filling
|
|
@@ -1369,10 +1391,13 @@ class histo2d:
|
|
|
1369
1391
|
"""
|
|
1370
1392
|
if not add:
|
|
1371
1393
|
# a new filling
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1394
|
+
self.res = np.histogram2d(x, y, **kwargs)
|
|
1395
|
+
if self.calc_w2 and self.has_weights:
|
|
1396
|
+
w_loc = kwargs['weights']**2
|
|
1397
|
+
# histogram with weights squared
|
|
1398
|
+
kwargs1 = copy.copy(kwargs)
|
|
1399
|
+
kwargs1['weights'] = w_loc
|
|
1400
|
+
self.w2 = np.histogram2d(x,y, **kwargs1)[0] # save only the bin content
|
|
1376
1401
|
self.__setup_bins(error = None)
|
|
1377
1402
|
else:
|
|
1378
1403
|
# the bins have already been defined continue
|
|
@@ -1381,8 +1406,15 @@ class histo2d:
|
|
|
1381
1406
|
print("no binning information: try fill with add = False ")
|
|
1382
1407
|
return
|
|
1383
1408
|
res = np.histogram2d(x, y, bins = [self.x_bins,self.y_bins], **kwargs)
|
|
1409
|
+
if self.calc_w2 and self.has_weights:
|
|
1410
|
+
w_loc = kwargs['weights']**2
|
|
1411
|
+
# histogram with weights squared
|
|
1412
|
+
kwargs1 = copy.copy(kwargs)
|
|
1413
|
+
kwargs1['weights'] = w_loc
|
|
1414
|
+
w2 = np.histogram2d(x,y, bins = [self.x_bins,self.y_bins], **kwargs1)[0] # save only the bin content
|
|
1384
1415
|
# add the new bin content to the old one
|
|
1385
1416
|
self.res = (self.res[0] + res[0], self.res[1], self.res[2])
|
|
1417
|
+
self.w2 += w2
|
|
1386
1418
|
# update the histogram information
|
|
1387
1419
|
self.__setup_bins(error = None)
|
|
1388
1420
|
# end of fill
|
|
@@ -1814,7 +1846,12 @@ class histo2d:
|
|
|
1814
1846
|
self.x_bins = self.res[1]
|
|
1815
1847
|
self.y_bins = self.res[2]
|
|
1816
1848
|
if error is None:
|
|
1817
|
-
self.
|
|
1849
|
+
if not self.has_weights: # no weights specified
|
|
1850
|
+
self.bin_error = np.sqrt(self.bin_content)
|
|
1851
|
+
elif self.calc_w2: # weights given and sum(weights**2) calculated for each bin
|
|
1852
|
+
self.bin_error = np.sqrt(self.w2)
|
|
1853
|
+
else:
|
|
1854
|
+
self.bin_error = np.sqrt(self.bin_content)
|
|
1818
1855
|
else:
|
|
1819
1856
|
self.bin_error = error
|
|
1820
1857
|
self.__prepare_histo_plot()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LabTools3
|
|
3
|
-
Version: 1.1.3.
|
|
3
|
+
Version: 1.1.3.14
|
|
4
4
|
Summary: Python 3 Package of modules for typical analysis tasks analyzing physics data
|
|
5
5
|
Home-page: http://wanda.fiu.edu/LabTools3
|
|
6
6
|
Author: Werner Boeglin
|
|
@@ -48,3 +48,5 @@ Version 1.1.3.11: new control on title and axes labels for plotting
|
|
|
48
48
|
Version 1.1.3.12: bug fixes, peak and background functions are available for histogram fits.
|
|
49
49
|
|
|
50
50
|
Version 1.1.3.13: fitting of only one parameters enabled for linear fits
|
|
51
|
+
|
|
52
|
+
Version 1.1.3.14: error calcualtion for filling histograms with weights include sum of weight**2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: LabTools3
|
|
3
|
-
Version: 1.1.3.
|
|
3
|
+
Version: 1.1.3.14
|
|
4
4
|
Summary: Python 3 Package of modules for typical analysis tasks analyzing physics data
|
|
5
5
|
Home-page: http://wanda.fiu.edu/LabTools3
|
|
6
6
|
Author: Werner Boeglin
|
|
@@ -48,3 +48,5 @@ Version 1.1.3.11: new control on title and axes labels for plotting
|
|
|
48
48
|
Version 1.1.3.12: bug fixes, peak and background functions are available for histogram fits.
|
|
49
49
|
|
|
50
50
|
Version 1.1.3.13: fitting of only one parameters enabled for linear fits
|
|
51
|
+
|
|
52
|
+
Version 1.1.3.14: error calcualtion for filling histograms with weights include sum of weight**2
|
|
@@ -33,4 +33,6 @@ Version 1.1.3.11: new control on title and axes labels for plotting
|
|
|
33
33
|
|
|
34
34
|
Version 1.1.3.12: bug fixes, peak and background functions are available for histogram fits.
|
|
35
35
|
|
|
36
|
-
Version 1.1.3.13: fitting of only one parameters enabled for linear fits
|
|
36
|
+
Version 1.1.3.13: fitting of only one parameters enabled for linear fits
|
|
37
|
+
|
|
38
|
+
Version 1.1.3.14: error calcualtion for filling histograms with weights include sum of weight**2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|