LabTools3 1.1.3.19__tar.gz → 1.1.3.20__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.
@@ -88,7 +88,7 @@ except:
88
88
  numpy_ok = False
89
89
 
90
90
  # function to create a dictionary from 2 lists: key, values
91
- format_dict = {'i':'{:d}', 'f':'{:f}', 's':'{:s}'}
91
+ format_dict = {'i':'{:d}', 'f':'{:f}', 's':'{:s}', 'g':'{:.12g}'}
92
92
  # create a dictionary from an array of keys and values
93
93
  #----------------------------------------------------------------------
94
94
  def find_duplicates(array):
@@ -466,6 +466,27 @@ class dfile:
466
466
  """
467
467
  return self.adata[:self.headindex+1]
468
468
 
469
+ def show_header(self, show_all = True):
470
+ """
471
+ Show the header information of the data file
472
+
473
+ Parameters
474
+ ----------
475
+ show_all : Bool, optional
476
+ Show all comments in the header otherwise only the headerline. The default is True.
477
+
478
+ Returns
479
+ -------
480
+ None.
481
+
482
+ """
483
+ if show_all:
484
+ for ll in self.get_full_header():
485
+ print(ll)
486
+ else:
487
+ print(self.get_header())
488
+
489
+
469
490
  def show_data(self,keylist):
470
491
  """
471
492
 
@@ -917,9 +938,16 @@ class dfile:
917
938
  fmt += format_dict[self.formats[k]] + ', '
918
939
  return fmt.strip()[:-1]
919
940
 
920
- def make_csv(self):
941
+ def make_csv(self, full_prec = False):
921
942
  keys = self.keys[:-1]
922
943
  csv = [ ''.join([k + ',' for k in keys]) ]
944
+ if full_prec:
945
+ for fk in self.formats.keys():
946
+ fmt = self.formats[fk]
947
+ if (fmt == 'i') or (fmt == 's'):
948
+ pass
949
+ else:
950
+ self.formats[fk] = 'g' # set the general float format key
923
951
  for l in self.data:
924
952
  fmt = self.make_fmt()
925
953
  data = [l[k] for k in keys]
@@ -927,16 +955,26 @@ class dfile:
927
955
  csv.append(ll)
928
956
  return csv
929
957
 
930
- def write_csv(self, f):
958
+ def write_csv(self, f, full_precision = True):
931
959
  """
932
-
960
+
933
961
  save the current file as a csv file
934
962
 
935
- f : file name to be used
936
-
963
+
964
+ Parameters
965
+ ----------
966
+ f : string
967
+ file name to be used.
968
+ full_precision : Bool, optional
969
+ use full precision g format for writing floats. The default is True.
970
+
971
+ Returns
972
+ -------
973
+ None.
974
+
937
975
  """
938
976
  o = open(f,'w')
939
- csv = self.make_csv()
977
+ csv = self.make_csv(full_prec = full_precision)
940
978
  for l in csv:
941
979
  o.write(l + '\n')
942
980
  o.close()
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: LabTools3
3
- Version: 1.1.3.19
3
+ Version: 1.1.3.20
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
@@ -19,6 +19,7 @@ Dynamic: description-content-type
19
19
  Dynamic: home-page
20
20
  Dynamic: keywords
21
21
  Dynamic: license
22
+ Dynamic: license-file
22
23
  Dynamic: requires-python
23
24
  Dynamic: summary
24
25
 
@@ -70,3 +71,5 @@ Version 1.1.3.17: Histogram window settings are now also saved to data file. Rep
70
71
  Version 1.1.3.18: Added plot_guess function to histo. This makes it easy to plot fit functions with guessed parameters.
71
72
 
72
73
  Version 1.1.3.19: Fixed but when using using the fill function in 1d histograms with weights multiple times.
74
+
75
+ Version 1.1.3.20: Added show_header to datafile and teh full_precision key word to write_csv.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: LabTools3
3
- Version: 1.1.3.19
3
+ Version: 1.1.3.20
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
@@ -19,6 +19,7 @@ Dynamic: description-content-type
19
19
  Dynamic: home-page
20
20
  Dynamic: keywords
21
21
  Dynamic: license
22
+ Dynamic: license-file
22
23
  Dynamic: requires-python
23
24
  Dynamic: summary
24
25
 
@@ -70,3 +71,5 @@ Version 1.1.3.17: Histogram window settings are now also saved to data file. Rep
70
71
  Version 1.1.3.18: Added plot_guess function to histo. This makes it easy to plot fit functions with guessed parameters.
71
72
 
72
73
  Version 1.1.3.19: Fixed but when using using the fill function in 1d histograms with weights multiple times.
74
+
75
+ Version 1.1.3.20: Added show_header to datafile and teh full_precision key word to write_csv.
@@ -45,4 +45,6 @@ Version 1.1.3.17: Histogram window settings are now also saved to data file. Rep
45
45
 
46
46
  Version 1.1.3.18: Added plot_guess function to histo. This makes it easy to plot fit functions with guessed parameters.
47
47
 
48
- Version 1.1.3.19: Fixed but when using using the fill function in 1d histograms with weights multiple times.
48
+ Version 1.1.3.19: Fixed but when using using the fill function in 1d histograms with weights multiple times.
49
+
50
+ Version 1.1.3.20: Added show_header to datafile and teh full_precision key word to write_csv.
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name = "LabTools3",
8
- version = "1.1.3.19",
8
+ version = "1.1.3.20",
9
9
  packages = find_packages(),
10
10
  # add additional files
11
11
  package_data = {'':['*.bat','*.command']},
File without changes
File without changes
File without changes
File without changes