@@ -510,6 +510,9 @@ def do_rdcsv(self, line):
510510 def do_rdsina (self , line ):
511511 self .do_readsina (line )
512512
513+ def do_rdsinah5 (self , line ):
514+ self .do_readsinahdf5 (line )
515+
513516 def do_cur (self , line ):
514517 self .do_curve (line )
515518
@@ -636,6 +639,8 @@ def do_help(self, arg):
636639 arg = 'readcsv'
637640 elif (arg == 'rdsina' ):
638641 arg = 'readsina'
642+ elif (arg == 'rdsinah5' ):
643+ arg = 'readsinahdf5'
639644 elif (arg == 'convol' ):
640645 arg = 'convolve'
641646 elif (arg == 'convolb' ):
@@ -1110,6 +1115,9 @@ def do_read(self, line):
11101115 elif line [- 1 ].endswith (".json" ):
11111116 self .do_readsina (" " .join (line ))
11121117 return
1118+ elif line [- 1 ].endswith (".hdf5" ) or line [- 1 ].endswith (".h5" ) or line [- 1 ].endswith (".hdf" ):
1119+ self .do_readsinahdf5 (" " .join (line ))
1120+ return
11131121
11141122 if n == 1 :
11151123 self .load (line [0 ])
@@ -1174,10 +1182,8 @@ def do_readcsv(self, line):
11741182
11751183 def do_readsina (self , line ):
11761184 """
1177- Read all curves from Sina data file. PyDV assumes there is only one record in the Sina file, and if there are
1178- more than one then PyDV only reads the first. PyDV also assumes there is only one independent variable per
1179- curve_set; if there are more than one then PyDV may exhibit undefined behavior. The next available prefix
1180- (see the prefix command) is automatically assigned the menu index of the first curve in each data file read.
1185+ Read all curves from Sina data file. The next available prefix (see the prefix command) is automatically
1186+ assigned the menu index of the first curve in each data file read.
11811187
11821188 .. code::
11831189
@@ -1196,6 +1202,28 @@ def do_readsina(self, line):
11961202 self .redraw = False
11971203 self .plotter .updateDialogs ()
11981204
1205+ def do_readsinahdf5 (self , line ):
1206+ """
1207+ Read all curves from Sina hdf5 data file. The next available prefix (see the prefix command) is automatically
1208+ assigned the menu index of the first curve in each data file read.
1209+
1210+ .. code::
1211+
1212+ [PyDV]: <readsinahdf5 | rdsinah5> <filename.hdf5>
1213+
1214+ Ex:
1215+ [PyDV]: readsinahdf5 my_file.hdf5
1216+ """
1217+
1218+ try :
1219+ line = line .split ()
1220+ self .load_sinahdf5 (line [0 ])
1221+ except :
1222+ pdvutil .print_own_docstring (self )
1223+ finally :
1224+ self .redraw = False
1225+ self .plotter .updateDialogs ()
1226+
11991227 def do_setxcolumn (self , line ):
12001228 """
12011229 Set x column for reading column formatted data files (.gnu or .csv).
@@ -9440,6 +9468,16 @@ def load_sina(self, fname):
94409468 self .curvelist += curves
94419469 self .filelist .append ((fname , len (curves )))
94429470
9471+ def load_sinahdf5 (self , fname ):
9472+ """
9473+ Load a Sina HDF5 data file, add parsed curves to the curvelist
9474+ """
9475+
9476+ curves = pydvpy .readsinahdf5 (fname , self .debug )
9477+ if len (curves ) > 0 :
9478+ self .curvelist += curves
9479+ self .filelist .append ((fname , len (curves )))
9480+
94439481 def loadrc (self ):
94449482 """
94459483 Read in a resource definition file
0 commit comments