nodes: 0, module; 1, function_definition; 2, function_name:data_from_cli; 3, parameters; 4, block; 5, identifier:opts; 6, expression_statement; 7, comment:# get gates to apply; 8, expression_statement; 9, expression_statement; 10, comment:# get strain time series; 11, expression_statement; 12, expression_statement; 13, comment:# apply gates if not waiting to overwhiten; 14, if_statement; 15, comment:# get strain time series to use for PSD estimation; 16, comment:# if user has not given the PSD time options then use same data as analysis; 17, if_statement; 18, comment:# FFT strain and save each of the length of the FFT, delta_f, and; 19, comment:# low frequency cutoff to a dict; 20, expression_statement; 21, expression_statement; 22, expression_statement; 23, expression_statement; 24, for_statement; 25, comment:# get PSD as frequency series; 26, expression_statement; 27, comment:# apply any gates to overwhitened data, if desired; 28, if_statement; 29, return_statement; 30, comment:"""Loads the data needed for a model from the given
      command-line options. Gates specifed on the command line are also applied.
  
      Parameters
      ----------
      opts : ArgumentParser parsed args
          Argument options parsed from a command line string (the sort of thing
          returned by `parser.parse_args`).
  
      Returns
      -------
      strain_dict : dict
          Dictionary of instruments -> `TimeSeries` strain.
      stilde_dict : dict
          Dictionary of instruments -> `FrequencySeries` strain.
      psd_dict : dict
          Dictionary of instruments -> `FrequencySeries` psds.
      """; 31, assignment; 32, assignment; 33, assignment; 34, assignment; 35, not_operator; 36, block; 37, boolean_operator; 38, block; 39, elif_clause; 40, else_clause; 41, assignment; 42, assignment; 43, assignment; 44, assignment; 45, identifier:ifo; 46, identifier:instruments; 47, block; 48, assignment; 49, boolean_operator; 50, block; 51, expression_list; 52, identifier:gates; 53, call; 54, identifier:psd_gates; 55, call; 56, identifier:instruments; 57, conditional_expression:opts.instruments if opts.instruments is not None else []; 58, identifier:strain_dict; 59, call; 60, attribute; 61, expression_statement; 62, attribute; 63, attribute; 64, expression_statement; 65, expression_statement; 66, expression_statement; 67, expression_statement; 68, expression_statement; 69, comment:# apply any gates; 70, expression_statement; 71, expression_statement; 72, boolean_operator; 73, block; 74, block; 75, identifier:stilde_dict; 76, dictionary; 77, identifier:length_dict; 78, dictionary; 79, identifier:delta_f_dict; 80, dictionary; 81, identifier:low_frequency_cutoff_dict; 82, call; 83, expression_statement; 84, expression_statement; 85, expression_statement; 86, identifier:psd_dict; 87, call; 88, attribute; 89, comparison_operator:opts.gate is not None; 90, expression_statement; 91, comment:# overwhiten the data; 92, for_statement; 93, expression_statement; 94, comment:# unwhiten the data for the model; 95, for_statement; 96, identifier:strain_dict; 97, identifier:stilde_dict; 98, identifier:psd_dict; 99, identifier:gates_from_cli; 100, argument_list; 101, identifier:psd_gates_from_cli; 102, argument_list; 103, attribute; 104, comparison_operator:opts.instruments is not None; 105, list; 106, identifier:strain_from_cli_multi_ifos; 107, argument_list; 108, identifier:opts; 109, identifier:gate_overwhitened; 110, assignment; 111, identifier:opts; 112, identifier:psd_start_time; 113, identifier:opts; 114, identifier:psd_end_time; 115, call; 116, assignment; 117, assignment; 118, assignment; 119, assignment; 120, call; 121, assignment; 122, attribute; 123, attribute; 124, raise_statement; 125, expression_statement; 126, identifier:low_frequency_cutoff_from_cli; 127, argument_list; 128, assignment; 129, assignment; 130, assignment; 131, identifier:psd_from_cli_multi_ifos; 132, argument_list; 133, identifier:opts; 134, identifier:gate_overwhitened; 135, attribute; 136, None; 137, call; 138, identifier:ifo; 139, identifier:gates; 140, block; 141, assignment; 142, identifier:ifo; 143, identifier:gates; 144, block; 145, identifier:opts; 146, identifier:opts; 147, identifier:opts; 148, identifier:instruments; 149, attribute; 150, None; 151, identifier:opts; 152, identifier:instruments; 153, keyword_argument; 154, identifier:strain_dict; 155, call; 156, attribute; 157, argument_list; 158, identifier:psd_opts; 159, identifier:opts; 160, attribute; 161, attribute; 162, attribute; 163, attribute; 164, identifier:psd_strain_dict; 165, call; 166, attribute; 167, argument_list; 168, identifier:psd_strain_dict; 169, call; 170, identifier:opts; 171, identifier:psd_start_time; 172, identifier:opts; 173, identifier:psd_end_time; 174, call; 175, assignment; 176, identifier:opts; 177, subscript; 178, call; 179, subscript; 180, call; 181, subscript; 182, attribute; 183, identifier:opts; 184, identifier:length_dict; 185, identifier:delta_f_dict; 186, identifier:low_frequency_cutoff_dict; 187, identifier:instruments; 188, keyword_argument; 189, keyword_argument; 190, identifier:opts; 191, identifier:gate; 192, attribute; 193, argument_list; 194, expression_statement; 195, identifier:stilde_dict; 196, call; 197, expression_statement; 198, identifier:opts; 199, identifier:instruments; 200, identifier:precision; 201, string:"double"; 202, identifier:apply_gates_to_td; 203, argument_list; 204, identifier:logging; 205, identifier:info; 206, concatenated_string; 207, identifier:psd_opts; 208, identifier:gps_start_time; 209, identifier:psd_opts; 210, identifier:psd_start_time; 211, identifier:psd_opts; 212, identifier:gps_end_time; 213, identifier:psd_opts; 214, identifier:psd_end_time; 215, identifier:strain_from_cli_multi_ifos; 216, argument_list; 217, identifier:logging; 218, identifier:info; 219, string:"Applying gates to PSD data"; 220, identifier:apply_gates_to_td; 221, argument_list; 222, identifier:ValueError; 223, argument_list; 224, identifier:psd_strain_dict; 225, identifier:strain_dict; 226, identifier:stilde_dict; 227, identifier:ifo; 228, attribute; 229, argument_list; 230, identifier:length_dict; 231, identifier:ifo; 232, identifier:len; 233, argument_list; 234, identifier:delta_f_dict; 235, identifier:ifo; 236, subscript; 237, identifier:delta_f; 238, identifier:strain_dict; 239, identifier:psd_strain_dict; 240, identifier:precision; 241, string:"double"; 242, identifier:logging; 243, identifier:info; 244, string:"Applying gates to overwhitened data"; 245, augmented_assignment; 246, identifier:apply_gates_to_fd; 247, argument_list; 248, augmented_assignment; 249, identifier:strain_dict; 250, identifier:gates; 251, string:"Will generate a different time series for PSD "; 252, string:"estimation"; 253, identifier:psd_opts; 254, identifier:instruments; 255, keyword_argument; 256, identifier:psd_strain_dict; 257, identifier:psd_gates; 258, string:"Must give --psd-start-time and --psd-end-time"; 259, subscript; 260, identifier:to_frequencyseries; 261, subscript; 262, identifier:stilde_dict; 263, identifier:ifo; 264, subscript; 265, subscript; 266, identifier:stilde_dict; 267, identifier:gates; 268, subscript; 269, subscript; 270, identifier:precision; 271, string:"double"; 272, identifier:strain_dict; 273, identifier:ifo; 274, identifier:stilde_dict; 275, identifier:ifo; 276, identifier:stilde_dict; 277, identifier:ifo; 278, identifier:psd_dict; 279, identifier:ifo; 280, identifier:stilde_dict; 281, identifier:ifo; 282, identifier:psd_dict; 283, identifier:ifo
code: def data_from_cli(opts):
      """Loads the data needed for a model from the given
      command-line options. Gates specifed on the command line are also applied.
  
      Parameters
      ----------
      opts : ArgumentParser parsed args
          Argument options parsed from a command line string (the sort of thing
          returned by `parser.parse_args`).
  
      Returns
      -------
      strain_dict : dict
          Dictionary of instruments -> `TimeSeries` strain.
      stilde_dict : dict
          Dictionary of instruments -> `FrequencySeries` strain.
      psd_dict : dict
          Dictionary of instruments -> `FrequencySeries` psds.
      """
      # get gates to apply
      gates = gates_from_cli(opts)
      psd_gates = psd_gates_from_cli(opts)
  
      # get strain time series
      instruments = opts.instruments if opts.instruments is not None else []
      strain_dict = strain_from_cli_multi_ifos(opts, instruments,
                                               precision="double")
      # apply gates if not waiting to overwhiten
      if not opts.gate_overwhitened:
          strain_dict = apply_gates_to_td(strain_dict, gates)
  
      # get strain time series to use for PSD estimation
      # if user has not given the PSD time options then use same data as analysis
      if opts.psd_start_time and opts.psd_end_time:
          logging.info("Will generate a different time series for PSD "
                       "estimation")
          psd_opts = opts
          psd_opts.gps_start_time = psd_opts.psd_start_time
          psd_opts.gps_end_time = psd_opts.psd_end_time
          psd_strain_dict = strain_from_cli_multi_ifos(psd_opts,
                                                       instruments,
                                                       precision="double")
          # apply any gates
          logging.info("Applying gates to PSD data")
          psd_strain_dict = apply_gates_to_td(psd_strain_dict, psd_gates)
  
      elif opts.psd_start_time or opts.psd_end_time:
          raise ValueError("Must give --psd-start-time and --psd-end-time")
      else:
          psd_strain_dict = strain_dict
  
      # FFT strain and save each of the length of the FFT, delta_f, and
      # low frequency cutoff to a dict
      stilde_dict = {}
      length_dict = {}
      delta_f_dict = {}
      low_frequency_cutoff_dict = low_frequency_cutoff_from_cli(opts)
      for ifo in instruments:
          stilde_dict[ifo] = strain_dict[ifo].to_frequencyseries()
          length_dict[ifo] = len(stilde_dict[ifo])
          delta_f_dict[ifo] = stilde_dict[ifo].delta_f
  
      # get PSD as frequency series
      psd_dict = psd_from_cli_multi_ifos(
          opts, length_dict, delta_f_dict, low_frequency_cutoff_dict,
          instruments, strain_dict=psd_strain_dict, precision="double")
  
      # apply any gates to overwhitened data, if desired
      if opts.gate_overwhitened and opts.gate is not None:
          logging.info("Applying gates to overwhitened data")
          # overwhiten the data
          for ifo in gates:
              stilde_dict[ifo] /= psd_dict[ifo]
          stilde_dict = apply_gates_to_fd(stilde_dict, gates)
          # unwhiten the data for the model
          for ifo in gates:
              stilde_dict[ifo] *= psd_dict[ifo]
  
      return strain_dict, stilde_dict, psd_dict