parameters: (data, variables, name=None, title=None, weight_name=None, clip_to_limits=True)
return_statement: return dataset
docstring: Create a RooDataSet from a dictionary of numpy arrays.
          Args:
              data (dict): Dictionary with strings as keys and numpy arrays as
                           values, to be imported into the RooDataSet.
              variables (RooArgSet, or list/tuple of RooAbsArgs):
                  Specification of the variables in the RooDataSet, will be
                  forwarded to the RooDataSet constructor. Both real values and
                  categories are supported.
              name (str): Name of the RooDataSet, `None` is equivalent to an
                          empty string.
              title (str): Title of the RooDataSet, `None` is equivalent to an
                           empty string.
              weight_name (str): Key of the array in `data` that will be used for
                                 the dataset weights.
              clip_to_limits (bool): When entries are added to a RooDataSet, the
                                     standard RooFit behavior is to clip the
                                     values to the limits specified by the
                                     binning of the RooFit variables. To save
                                     computational cost, you can disable this
                                     clipping if not necessary in your workflow.
  
          Returns:
              RooDataSet
docstring_summary: Create a RooDataSet from a dictionary of numpy arrays.
          Args:
              data (dict): Dictionary with strings as keys and numpy arrays as
                           values, to be imported into the RooDataSet.
              variables (RooArgSet, or list/tuple of RooAbsArgs):
                  Specification of the variables in the RooDataSet, will be
                  forwarded to the RooDataSet constructor. Both real values and
                  categories are supported.
              name (str): Name of the RooDataSet, `None` is equivalent to an
                          empty string.
              title (str): Title of the RooDataSet, `None` is equivalent to an
                           empty string.
              weight_name (str): Key of the array in `data` that will be used for
                                 the dataset weights.
              clip_to_limits (bool): When entries are added to a RooDataSet, the
                                     standard RooFit behavior is to clip the
                                     values to the limits specified by the
                                     binning of the RooFit variables. To save
                                     computational cost, you can disable this
                                     clipping if not necessary in your workflow.
docstring_tokens: Create a RooDataSet from a dictionary of numpy arrays . Args : data ( dict ) : Dictionary with strings as keys and numpy arrays as values to be imported into the RooDataSet . variables ( RooArgSet or list / tuple of RooAbsArgs ) : Specification of the variables in the RooDataSet will be forwarded to the RooDataSet constructor . Both real values and categories are supported . name ( str ) : Name of the RooDataSet None is equivalent to an empty string . title ( str ) : Title of the RooDataSet None is equivalent to an empty string . weight_name ( str ) : Key of the array in data that will be used for the dataset weights . clip_to_limits ( bool ) : When entries are added to a RooDataSet the standard RooFit behavior is to clip the values to the limits specified by the binning of the RooFit variables . To save computational cost you can disable this clipping if not necessary in your workflow .
function: def from_numpy(data, variables, name=None, title=None, weight_name=None, clip_to_limits=True):
          """Create a RooDataSet from a dictionary of numpy arrays.
          Args:
              data (dict): Dictionary with strings as keys and numpy arrays as
                           values, to be imported into the RooDataSet.
              variables (RooArgSet, or list/tuple of RooAbsArgs):
                  Specification of the variables in the RooDataSet, will be
                  forwarded to the RooDataSet constructor. Both real values and
                  categories are supported.
              name (str): Name of the RooDataSet, `None` is equivalent to an
                          empty string.
              title (str): Title of the RooDataSet, `None` is equivalent to an
                           empty string.
              weight_name (str): Key of the array in `data` that will be used for
                                 the dataset weights.
              clip_to_limits (bool): When entries are added to a RooDataSet, the
                                     standard RooFit behavior is to clip the
                                     values to the limits specified by the
                                     binning of the RooFit variables. To save
                                     computational cost, you can disable this
                                     clipping if not necessary in your workflow.
  
          Returns:
              RooDataSet
          """
          import ROOT
          import numpy as np
          import ctypes
  
          name = "" if name is None else name
          title = "" if title is None else title
  
          if weight_name is None:
              dataset = ROOT.RooDataSet(name, title, variables)
          else:
              dataset = ROOT.RooDataSet(name, title, variables, weight_name)
  
          for real in dataset.store().realStoreList():
              vec = real.data()
              arg = real.bufArg()
              arr = data[arg.GetName()]
  
              if clip_to_limits:
                  arr = np.clip(arr, a_min=arg.getMin(), a_max=arg.getMax())
  
              arr = arr if arr.dtype == np.float64 else np.array(arr, dtype=np.float64)
              vec.resize(len(arr))
  
              beg = arr.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
              void_p = ctypes.cast(beg, ctypes.c_voidp).value + 8 * len(arr)
              end = ctypes.cast(void_p, ctypes.POINTER(ctypes.c_double))
              ROOT.std.copy(beg, end, vec.begin())
  
          for cat in dataset.store().catStoreList():
              vec = cat.data()
              arr = data[cat.bufArg().GetName()]
              arr = arr if arr.dtype == np.int32 else np.array(arr, dtype=np.int32)
              vec.resize(len(arr))
  
              beg = arr.ctypes.data_as(ctypes.POINTER(ctypes.c_int))
              void_p = ctypes.cast(beg, ctypes.c_voidp).value + 4 * len(arr)
              end = ctypes.cast(void_p, ctypes.POINTER(ctypes.c_int))
              ROOT.std.copy(beg, end, vec.begin())
  
          dataset.store().recomputeSumWeight()
  
          n_entries = None
  
          for real in dataset.store().realStoreList():
              if n_entries is None:
                  n_entries = real.size()
              assert n_entries == real.size()
  
          for cat in dataset.store().catStoreList():
              assert n_entries == cat.size()
  
          return dataset
function_tokens: def from_numpy ( data , variables , name = None , title = None , weight_name = None , clip_to_limits = True ) : import ROOT import numpy as np import ctypes name = "" if name is None else name title = "" if title is None else title if weight_name is None : dataset = ROOT . RooDataSet ( name , title , variables ) else : dataset = ROOT . RooDataSet ( name , title , variables , weight_name ) for real in dataset . store ( ) . realStoreList ( ) : vec = real . data ( ) arg = real . bufArg ( ) arr = data [ arg . GetName ( ) ] if clip_to_limits : arr = np . clip ( arr , a_min = arg . getMin ( ) , a_max = arg . getMax ( ) ) arr = arr if arr . dtype == np . float64 else np . array ( arr , dtype = np . float64 ) vec . resize ( len ( arr ) ) beg = arr . ctypes . data_as ( ctypes . POINTER ( ctypes . c_double ) ) void_p = ctypes . cast ( beg , ctypes . c_voidp ) . value + 8 * len ( arr ) end = ctypes . cast ( void_p , ctypes . POINTER ( ctypes . c_double ) ) ROOT . std . copy ( beg , end , vec . begin ( ) ) for cat in dataset . store ( ) . catStoreList ( ) : vec = cat . data ( ) arr = data [ cat . bufArg ( ) . GetName ( ) ] arr = arr if arr . dtype == np . int32 else np . array ( arr , dtype = np . int32 ) vec . resize ( len ( arr ) ) beg = arr . ctypes . data_as ( ctypes . POINTER ( ctypes . c_int ) ) void_p = ctypes . cast ( beg , ctypes . c_voidp ) . value + 4 * len ( arr ) end = ctypes . cast ( void_p , ctypes . POINTER ( ctypes . c_int ) ) ROOT . std . copy ( beg , end , vec . begin ( ) ) dataset . store ( ) . recomputeSumWeight ( ) n_entries = None for real in dataset . store ( ) . realStoreList ( ) : if n_entries is None : n_entries = real . size ( ) assert n_entries == real . size ( ) for cat in dataset . store ( ) . catStoreList ( ) : assert n_entries == cat . size ( ) return dataset