diff --git a/CAL/CalibrationProcessing/lib/processing/averaging.py b/CAL/CalibrationProcessing/lib/processing/averaging.py index 5e713713363ee6c92caa2780eabb69dd736d35ef..dfa8f59232f104585a7446e7054a7ea603ddb904 100644 --- a/CAL/CalibrationProcessing/lib/processing/averaging.py +++ b/CAL/CalibrationProcessing/lib/processing/averaging.py @@ -45,20 +45,20 @@ def average_values_by_sample(data_array, window_size, field_name=None): result['mean'][i] = numpy.nanmean(data_array_view) if numpy.issubdtype(field_dtype, numpy.complexfloating): - result['std_real'][i] = numpy.std(numpy.real(data_array_view)) - result['std_imag'][i] = numpy.std(numpy.imag(data_array_view)) + result['std_real'][i] = numpy.nanstd(numpy.real(data_array_view)) + result['std_imag'][i] = numpy.nanstd(numpy.imag(data_array_view)) else: - result['std'][i] = numpy.std(data_array_view) + result['std'][i] = numpy.nanstd(data_array_view) # Counts the values that are not nan therefore the one used to do the mean result['averaged_samples'][i] = numpy.count_nonzero(~numpy.isnan(data_array_view)) data_array_view = data_array[(new_array_size - 1) * window_size:] result['mean'][-1] = numpy.nanmean(data_array_view) if numpy.issubdtype(field_dtype, numpy.complexfloating): - result['std_real'][-1] = numpy.std(numpy.real(data_array_view)) - result['std_imag'][-1] = numpy.std(numpy.imag(data_array_view)) + result['std_real'][-1] = numpy.nanstd(numpy.real(data_array_view)) + result['std_imag'][-1] = numpy.nanstd(numpy.imag(data_array_view)) else: - result['std'][-1] = numpy.std(data_array_view) + result['std'][-1] = numpy.nanstd(data_array_view) # Counts the values that are not nan therefore the one used to do the mean result['averaged_samples'][-1] = numpy.count_nonzero(~numpy.isnan(data_array_view)) @@ -464,6 +464,7 @@ def weighted_average_dataset_per_station(dataset, input_data_table): :return: """ stations = dataset.reference_stations + first_station = stations[0] frequencies = dataset.frequencies @@ -473,8 +474,7 @@ def weighted_average_dataset_per_station(dataset, input_data_table): frequency_string = str(frequency) result_per_frequency = dict() result_ALL[str(frequency)] = result_per_frequency - - for beam_str in input_data_table[frequency_string]: + for beam_str in input_data_table[first_station][frequency_string]: result_per_beam = numpy.zeros(1, dtype=HDS_data_sample_type)