def plh_sum_proc():
    """Sum all datasets contained in plot 3"""
    from Reduction import reduction
    from Formats import output
    filename = str(plh_file.value)
    datasets = Plot3.ds
    approach = str(plh_sum_type.value)
    if approach == 'Ideal':
        newds = reduction.sum_datasets(datasets)
        send_to_plot(newds,Plot2,add=False)
    else:
        newds = reduction.merge_datasets(datasets)
        if approach == 'Cluster':
            cluster = float(plh_cluster.value)
            if cluster > 0:
                newds,info_string = reduction.debunch(newds,(cluster,''))
        send_to_plot(newds,Plot2,add=False)
    n_logger.log_plot(Plot2, footer = Plot2.title)
        # Write to file
    if filename != '':
            output.write_cif_data(newds,filename)
            if output_xyd.value:
                output.write_xyd_data(newds,filename)
            if output_fxye.value:
                output.write_fxye_data(newds,filename)
            if output_topas.value:
                output.write_xyd_data(newds,filename,comment_char="!")
Exemple #2
0
 def testClusterMerge(self):
      """Test that values are clustered correctly"""
      output = reduction.merge_datasets([self.first_dataset,self.second_dataset,self.third_dataset])
      output = reduction.debunch(output,0.25)
      self.assertEqual(output[0],2)
      self.assertAlmostEqual(output.var[0], 3.5/9.0)
      self.assertEqual(output.axes[0],1.02)
def sub_plot_proc():
    """Subtract two datasets given their titles only"""
    # We use the same approach as summation in the
    # main Echidna GUI routines. We first merge,
    # then sum.
    top_name = str(first_ds.value)
    bot_name = str(subbed_ds.value)
    top_ds, t = find_ds_by_title(top_name)
    bottom_ds, b = find_ds_by_title(bot_name)
    neg_ds = bottom_ds * (-1.0)
    final_ds = reduction.merge_datasets([top_ds, neg_ds])
    final_ds, info_string = reduction.debunch(final_ds, (0.03, "None"))  # for testing, for now
    final_ds.title = "Subtracted datasets"
    Plot2.set_dataset(final_ds)
Exemple #4
0
def plh_sum_proc():
    """Sum all datasets contained in plot 3"""
    from Reduction import reduction
    from Formats import output
    filename = str(plh_file.value)
    datasets = Plot3.ds
    approach = str(plh_sum_type.value)
    if approach == 'Ideal':
        newds = reduction.sum_datasets(datasets)
        send_to_plot(newds, Plot2, add=False)
    else:
        newds = reduction.merge_datasets(datasets)
        if approach == 'Cluster':
            cluster = float(plh_cluster.value)
            if cluster > 0:
                newds = reduction.debunch(newds, cluster)
        send_to_plot(newds, Plot2, add=False)
        # Write to file
    if filename != '':
        output.write_cif_data(newds, filename)
        if output_xyd.value:
            output.write_xyd_data(newds, filename)
        if output_fxye.value:
            output.write_fxye_data(newds, filename)
def plh_sum_proc():
    """Sum all datasets contained in plot 3"""
    from Reduction import reduction
    from Formats import output
    filename = str(plh_file.value)
    datasets = Plot3.ds
    approach = str(plh_sum_type.value)
    if approach == 'Ideal':
        newds = reduction.sum_datasets(datasets)
        send_to_plot(newds,Plot2,add=False)
    else:
        newds = reduction.merge_datasets(datasets)
        if approach == 'Cluster':
            cluster = float(plh_cluster.value)
            if cluster > 0:
                newds = reduction.debunch(newds,cluster)
        send_to_plot(newds,Plot2,add=False)
        # Write to file
    if filename != '':
            output.write_cif_data(newds,filename)
            if output_xyd.value:
                output.write_xyd_data(newds,filename)
            if output_fxye.value:
                output.write_fxye_data(newds,filename)