示例#1
0
文件: store.py 项目: weiyangliu/qkit
 def add_value_vector(self,
                      name,
                      x,
                      unit="",
                      comment="",
                      folder="data",
                      **meta):
     """Adds a 1dim dataset to the h5 file.
     
     This function is a wrapper to create a hdf_dataset object with some 
     predefined arguments. name, x-axis, unit, comment, and folder are parsed
     to the hdf_dataset init and the ds_type is set.
     
     Args:
         name: String to name the dataset.
         x: Optional hdf_dataset representing the x-coordinate of the vector.
         unit: Optional string.
         comment: Optional string to put in any comment.
         folder: Optional string ('data' or 'analysis').
     
     Returns:
         hdf_dataset object.
     """
     ds = hdf_dataset(self.hf,
                      name,
                      x=x,
                      unit=unit,
                      ds_type=ds_types['vector'],
                      comment=comment,
                      folder=folder,
                      dim=1,
                      **meta)
     return ds
示例#2
0
文件: store.py 项目: weiyangliu/qkit
 def add_coordinate(self, name, unit="", comment="", folder="data", **meta):
     """Adds a coordinate dataset to the h5 file.
     
     This function is a wrapper to create a hdf_dataset object with some 
     predefined arguments. name, unit, comment, and folder are parsed to the hdf_dataset
     init and the ds_type is set. The dataset does not have any axes. The data
     is specifically casted to 64bit float.
     
     Args:
         name: String to name the dataset.
         unit: Optional string.
         comment: Optional string to put in any comment.
         folder: Optional string ('data' or 'analysis').
     
     Returns:
         hdf_dataset object.
     """
     ds = hdf_dataset(self.hf,
                      name,
                      unit=unit,
                      ds_type=ds_types['coordinate'],
                      comment=comment,
                      folder=folder,
                      dtype='float64',
                      dim=1,
                      **meta)
     return ds
示例#3
0
 def add_textlist(self, name, comment="", folder="data", **meta):
     ds = hdf_dataset(self.hf,
                      name,
                      comment=comment,
                      folder=folder,
                      ds_type=ds_types['txt'],
                      dim=1,
                      **meta)
     return ds
示例#4
0
 def add_coordinate(self, name, unit="", comment="", folder="data", **meta):
     ds = hdf_dataset(self.hf,
                      name,
                      unit=unit,
                      ds_type=ds_types['coordinate'],
                      comment=comment,
                      folder=folder,
                      dtype='float64',
                      **meta)
     return ds
示例#5
0
 def add_value_vector(self,
                      name,
                      x=None,
                      unit="",
                      comment="",
                      folder="data",
                      **meta):
     ds = hdf_dataset(self.hf,
                      name,
                      x=x,
                      unit=unit,
                      ds_type=ds_types['vector'],
                      comment=comment,
                      folder=folder,
                      **meta)
     return ds
示例#6
0
 def add_textlist(self,name,comment = "" ,folder="data", **meta):
     """Adds a dataset containing only text to the h5 file.
     
     This function is a wrapper to create a hdf_dataset object with some 
     predefined arguments. name, comment, and folder are parsed to the hdf_dataset
     init and the ds_type is set. The dataset does not have any axes.
     
     Args:
         name: String to name the dataset.
         comment: Optional string to put in any comment.
         folder: Optional string ('data' or 'analysis').
     
     Returns:
         hdf_dataset object.
     """
     ds =  hdf_dataset(self.hf, name, comment = comment, folder=folder, ds_type = ds_types['txt'], dim=1, **meta)
     return ds
示例#7
0
 def add_value_matrix(self,
                      name,
                      x=None,
                      y=None,
                      unit="",
                      comment="",
                      folder="data",
                      **meta):
     ds = hdf_dataset(self.hf,
                      name,
                      x=x,
                      y=y,
                      unit=unit,
                      ds_type=ds_types['matrix'],
                      comment=comment,
                      folder=folder,
                      **meta)
     return ds
示例#8
0
文件: store.py 项目: weiyangliu/qkit
 def add_value_box(self,
                   name,
                   x,
                   y,
                   z,
                   unit="",
                   comment="",
                   folder="data",
                   **meta):
     """Adds a 3dim dataset to the h5 file.
     
     This function is a wrapper to create a hdf_dataset object with some 
     predefined arguments. name, x-axis, y-axis, z-axis, unit, comment, and folder 
     are parsed to the hdf_dataset init and the ds_type is set.
     Our convention here is: y-axis changes "faster" than the x-axis.
     
     Args:
         name: String to name the dataset.
         x: Optional hdf_dataset representing the x-coordinate of the box.
         y: Optional hdf_dataset representing the y-coordinato of the box.
         z: Optional hdf_dataset representing the y-coordinato of the box.
         unit: Optional string.
         comment: Optional string to put in any comment.
         folder: Optional string ('data' or 'analysis').
     
     Returns:
         hdf_dataset object.
     """
     ds = hdf_dataset(self.hf,
                      name,
                      x=x,
                      y=y,
                      z=z,
                      unit=unit,
                      ds_type=ds_types['box'],
                      comment=comment,
                      folder=folder,
                      dim=3,
                      **meta)
     return ds
示例#9
0
 def get_dataset(self, ds_url):
     return hdf_dataset(self.hf, ds_url=ds_url)