teresaupdyke / qccodar

This Python code applies several quality control (QC) functions based on CODAR SeaSonde (COS) Radial Metric data.
GNU General Public License v2.0
2 stars 2 forks source link

tests updated and qcutils.weighted_velocities much faster #15

Closed neaptide closed 2 years ago

neaptide commented 2 years ago

Two main updates:

  1. updated tests (working with nose module "nosetests")
  2. Fixed qcutil.weighted_velocities to run 50x faster (was taking 40-50 sec now only takes 1-2 sec).

Updated most of the tests in src/qccodar/test to work with changes made in qccodar3. This basically fulfills Issue #3
#

Fixed qcutil.weighted_velocities to run 50x faster. It was taking 40-50 sec to complete weighted avg because of indexing into a dataframe in a big loop. This also might be the cause of slowness and CPU overheating on CORE and HATY. I reverted the code to use numpy array to do the weighting and then create a dataframe with the numpy array. Indexing a numpy array is much faster. Now it only takes 1 sec! and verified it is correct by using nosetests. I had to add back get_columns and unique_rows to make this work.


(qccodar) vector:qccodar codar$ nosetests -v ./test qccodar.test.test_qc.test_no_qc ... ok qccodar.test.test_qc.test_threshold_qc_doa_peak_power ... ok qccodar.test.test_qc.test_threshold_qc_doa_half_power_width ... ok qccodar.test.test_qc.test_threshold_qc_monopole_snr ... ok qccodar.test.test_qc.test_threshold_qc_loop_snr ... ok qccodar.test.test_qc.test_threshold_qc_all ... ok qccodar.test.test_qc.test_weighted_average_mp_weight_angres1 ... ok qccodar.test.test_qc.test_weighted_average_snr_weight_angres1 ... ok qccodar.test.test_qc.test_weighted_average_no_weight_angres1 ... ok qccodar.test.test_qccodar_values.test_load_qccodar_values_from_plist ... ok qccodar.test.test_qccodar_values.test_qccodar_values_for_qc ... ok qccodar.test.test_qccodar_values.test_qccodar_values_for_radialshorts ... ok qccodar.test.test_qccodar_values.test_qccodar_values_for_merge ... ok qccodar.test.test_radialshorts.test_generate_radialshort_array ... ok qccodar.test.test_radialshorts.test_generate_radialshort_empty_array_when_no_radial_data ... ok test_load_data -- Read the file as list of lines ... ok test_read_lluv_file -- Read typical LLUV data that has data as a Radial object ... ok test_read_lluv_empty_file -- Read LLUV data that has NO radial data as a Radial object ... ok Write empty LLUV file output, and test by comparing to readback. ... ERROR Write typical LLUV file output test by comparing to readback. ... FAIL