original_docstring: 
          Run the analysis for this stage.
          
           - Collect the list of columns to read
           - Create iterators to read chunks of those columns
           - Loop through chunks:
              - select objects for each bin
              - write them out
              - accumulate selection bias values
           - Average the selection biases
           - Write out biases and close the output
          
docstring: Run the analysis for this stage.
  Collect the list of columns to read
  Create iterators to read chunks of those columns
  Loop through chunks:
  select objects for each bin
  write them out
  accumulate selection bias values
  Average the selection biases
  Write out biases and close the output
docstring_tokens: Run the analysis for this stage . Collect the list of columns to read Create iterators to read chunks of those columns Loop through chunks : select objects for each bin write them out accumulate selection bias values Average the selection biases Write out biases and close the output
code: def run(self):
          """
          Run the analysis for this stage.
          
           - Collect the list of columns to read
           - Create iterators to read chunks of those columns
           - Loop through chunks:
              - select objects for each bin
              - write them out
              - accumulate selection bias values
           - Average the selection biases
           - Write out biases and close the output
          """
          import astropy.table
          import sklearn.ensemble
  
          if self.name == "TXBaseLensSelector":
              raise ValueError("Do not run TXBaseLensSelector - run a sub-class")
  
          # Suppress some warnings from numpy that are not relevant
          original_warning_settings = np.seterr(all='ignore')  
  
          # The output file we will put the tomographic
          # information into
          output_file = self.setup_output()
  
          iterator = self.data_iterator()
  
          # We will collect the selection biases for each bin
          # as a matrix.  We will collect together the different
          # matrices for each chunk and do a weighted average at the end.
          nbin_lens = len(self.config['lens_zbin_edges']) - 1
  
          number_density_stats = LensNumberDensityStats(nbin_lens, self.comm)
  
          # Loop through the input data, processing it chunk by chunk
          for (start, end, phot_data) in iterator:
              print(f"Process {self.rank} running selection for rows {start:,}-{end:,}")
  
              pz_data = self.apply_redshift_cut(phot_data)
  
              # Select lens bin objects
              lens_gals = self.select_lens(phot_data)
  
              # Combine this selection with size and snr cuts to produce a source selection
              # and calculate the shear bias it would generate
              tomo_bin, counts = self.calculate_tomography(pz_data, phot_data, lens_gals)
  
              # Save the tomography for this chunk
              self.write_tomography(output_file, start, end, tomo_bin)
  
              # Accumulate information on the number counts and the selection biases.
              # These will be brought together at the end.
              number_density_stats.add_data(tomo_bin)
  
          # Do the selection bias averaging and output that too.
          self.write_global_values(output_file, number_density_stats)
  
          # Save and complete
          output_file.close()
  
          # Restore the original warning settings in case we are being called from a library
          np.seterr(**original_warning_settings)
code_tokens: def run ( self ) : import astropy . table import sklearn . ensemble if self . name == "TXBaseLensSelector" : raise ValueError ( "Do not run TXBaseLensSelector - run a sub-class" ) original_warning_settings = np . seterr ( all = 'ignore' ) output_file = self . setup_output ( ) iterator = self . data_iterator ( ) nbin_lens = len ( self . config [ 'lens_zbin_edges' ] ) - 1 number_density_stats = LensNumberDensityStats ( nbin_lens , self . comm ) for ( start , end , phot_data ) in iterator : print ( f"Process {self.rank} running selection for rows {start:,}-{end:,}" ) pz_data = self . apply_redshift_cut ( phot_data ) lens_gals = self . select_lens ( phot_data ) tomo_bin , counts = self . calculate_tomography ( pz_data , phot_data , lens_gals ) self . write_tomography ( output_file , start , end , tomo_bin ) number_density_stats . add_data ( tomo_bin ) self . write_global_values ( output_file , number_density_stats ) output_file . close ( ) np . seterr ( ** original_warning_settings )
short_docstring: Run the analysis for this stage.
short_docstring_tokens: Run the analysis for this stage .
comment: """
          Run the analysis for this stage.
          
           - Collect the list of columns to read
           - Create iterators to read chunks of those columns
           - Loop through chunks:
              - select objects for each bin
              - write them out
              - accumulate selection bias values
           - Average the selection biases
           - Write out biases and close the output
          """$SEP$# Suppress some warnings from numpy that are not relevant$SEP$# The output file we will put the tomographic$SEP$# information into$SEP$# We will collect the selection biases for each bin$SEP$# as a matrix.  We will collect together the different$SEP$# matrices for each chunk and do a weighted average at the end.$SEP$# Loop through the input data, processing it chunk by chunk$SEP$# Select lens bin objects$SEP$# Combine this selection with size and snr cuts to produce a source selection$SEP$# and calculate the shear bias it would generate$SEP$# Save the tomography for this chunk$SEP$# Accumulate information on the number counts and the selection biases.$SEP$# These will be brought together at the end.$SEP$# Do the selection bias averaging and output that too.$SEP$# Save and complete$SEP$# Restore the original warning settings in case we are being called from a library