nodes: 0, module; 1, function_definition; 2, function_name:create_waveform_generator; 3, parameters; 4, block; 5, identifier:variable_params; 6, identifier:data; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, comment:# figure out what generator to use based on the approximant; 12, try_statement; 13, expression_statement; 14, comment:# get data parameters; we'll just use one of the data to get the; 15, comment:# values, then check that all the others are the same; 16, expression_statement; 17, for_statement; 18, expression_statement; 19, return_statement; 20, identifier:recalibration; 21, None; 22, identifier:gates; 23, None; 24, identifier:static_params; 25, comment:"""Creates a waveform generator for use with a model.
  
      Parameters
      ----------
      variable_params : list of str
          The names of the parameters varied.
      data : dict
          Dictionary mapping detector names to either a
          :py:class:`<pycbc.types.TimeSeries TimeSeries>` or
          :py:class:`<pycbc.types.FrequencySeries FrequencySeries>`.
      recalibration : dict, optional
          Dictionary mapping detector names to
          :py:class:`<pycbc.calibration.Recalibrate>` instances for
          recalibrating data.
      gates : dict of tuples, optional
          Dictionary of detectors -> tuples of specifying gate times. The
          sort of thing returned by :py:func:`pycbc.gate.gates_from_cli`.
  
      Returns
      -------
      pycbc.waveform.FDomainDetFrameGenerator
          A waveform generator for frequency domain generation.
      """; 26, block; 27, except_clause; 28, assignment; 29, assignment; 30, identifier:d; 31, call; 32, block; 33, assignment; 34, identifier:waveform_generator; 35, expression_statement; 36, identifier:KeyError; 37, block; 38, identifier:generator_function; 39, call; 40, identifier:delta_f; 41, None; 42, attribute; 43, argument_list; 44, if_statement; 45, identifier:waveform_generator; 46, call; 47, assignment; 48, raise_statement; 49, attribute; 50, argument_list; 51, identifier:data; 52, identifier:values; 53, comparison_operator:delta_f is None; 54, block; 55, else_clause; 56, attribute; 57, argument_list; 58, identifier:approximant; 59, subscript; 60, call; 61, identifier:generator; 62, identifier:select_waveform_generator; 63, identifier:approximant; 64, identifier:delta_f; 65, None; 66, expression_statement; 67, expression_statement; 68, expression_statement; 69, block; 70, identifier:generator; 71, identifier:FDomainDetFrameGenerator; 72, identifier:generator_function; 73, keyword_argument; 74, keyword_argument; 75, keyword_argument; 76, keyword_argument; 77, keyword_argument; 78, keyword_argument; 79, keyword_argument; 80, dictionary_splat; 81, identifier:static_params; 82, string; 83, identifier:ValueError; 84, argument_list; 85, assignment; 86, assignment; 87, assignment; 88, if_statement; 89, identifier:epoch; 90, identifier:start_time; 91, identifier:variable_args; 92, identifier:variable_params; 93, identifier:detectors; 94, call; 95, identifier:delta_f; 96, identifier:delta_f; 97, identifier:delta_t; 98, identifier:delta_t; 99, identifier:recalib; 100, identifier:recalibration; 101, identifier:gates; 102, identifier:gates; 103, identifier:static_params; 104, string_content:approximant; 105, string:"no approximant provided in the static args"; 106, identifier:delta_f; 107, attribute; 108, identifier:delta_t; 109, attribute; 110, identifier:start_time; 111, attribute; 112, not_operator; 113, block; 114, identifier:list; 115, argument_list; 116, identifier:d; 117, identifier:delta_f; 118, identifier:d; 119, identifier:delta_t; 120, identifier:d; 121, identifier:start_time; 122, call; 123, raise_statement; 124, call; 125, identifier:all; 126, argument_list; 127, call; 128, attribute; 129, argument_list; 130, list; 131, identifier:ValueError; 132, argument_list; 133, identifier:data; 134, identifier:keys; 135, comparison_operator:d.delta_f == delta_f; 136, comparison_operator:d.delta_t == delta_t; 137, comparison_operator:d.start_time == start_time; 138, concatenated_string; 139, attribute; 140, identifier:delta_f; 141, attribute; 142, identifier:delta_t; 143, attribute; 144, identifier:start_time; 145, string:"data must all have the same delta_t, "; 146, string:"delta_f, and start_time"; 147, identifier:d; 148, identifier:delta_f; 149, identifier:d; 150, identifier:delta_t; 151, identifier:d; 152, identifier:start_time
code: def create_waveform_generator(variable_params, data,
                                recalibration=None, gates=None,
                                **static_params):
      """Creates a waveform generator for use with a model.
  
      Parameters
      ----------
      variable_params : list of str
          The names of the parameters varied.
      data : dict
          Dictionary mapping detector names to either a
          :py:class:`<pycbc.types.TimeSeries TimeSeries>` or
          :py:class:`<pycbc.types.FrequencySeries FrequencySeries>`.
      recalibration : dict, optional
          Dictionary mapping detector names to
          :py:class:`<pycbc.calibration.Recalibrate>` instances for
          recalibrating data.
      gates : dict of tuples, optional
          Dictionary of detectors -> tuples of specifying gate times. The
          sort of thing returned by :py:func:`pycbc.gate.gates_from_cli`.
  
      Returns
      -------
      pycbc.waveform.FDomainDetFrameGenerator
          A waveform generator for frequency domain generation.
      """
      # figure out what generator to use based on the approximant
      try:
          approximant = static_params['approximant']
      except KeyError:
          raise ValueError("no approximant provided in the static args")
      generator_function = generator.select_waveform_generator(approximant)
      # get data parameters; we'll just use one of the data to get the
      # values, then check that all the others are the same
      delta_f = None
      for d in data.values():
          if delta_f is None:
              delta_f = d.delta_f
              delta_t = d.delta_t
              start_time = d.start_time
          else:
              if not all([d.delta_f == delta_f, d.delta_t == delta_t,
                          d.start_time == start_time]):
                  raise ValueError("data must all have the same delta_t, "
                                   "delta_f, and start_time")
      waveform_generator = generator.FDomainDetFrameGenerator(
          generator_function, epoch=start_time,
          variable_args=variable_params, detectors=list(data.keys()),
          delta_f=delta_f, delta_t=delta_t,
          recalib=recalibration, gates=gates,
          **static_params)
      return waveform_generator