| 1 |
Test plan for ETC-related category of tests |
| 2 |
|
| 3 |
Summary: |
| 4 |
|
| 5 |
There exists a large number of ETC regression test cases with answers, |
| 6 |
provided by INS. However, these are not suitable for directly testing |
| 7 |
of pysynphot, because they perform comparisons of values calculated by |
| 8 |
the ETC based on pysynphot results, and other things. |
| 9 |
|
| 10 |
Therefore, the (py)synphot commands will be extracted from these test |
| 11 |
cases; we will then run the commands directly through the equivalent |
| 12 |
pairs of synphot/pysynphot commands. This permits a direct comparison |
| 13 |
between synphot and pysynphot; discrepant results will be submitted to |
| 14 |
INS for assessment. |
| 15 |
|
| 16 |
Once pysynphot has passed this large suite of tests, the pysynphot |
| 17 |
answers will be accepted as "truth", and the tests will be modified |
| 18 |
into true regression tests, using a specific named set of CDBS |
| 19 |
files; this is how most pysynphot tests are run to protect against |
| 20 |
"false positive" test failures due only to a change in data files. |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
Test definitions: |
| 25 |
|
| 26 |
For each test case, consisting of a spectrum specification, an obsmode |
| 27 |
specification (usually), and a taskname, the following tests will be |
| 28 |
performed: |
| 29 |
|
| 30 |
- Compare the throughput arrays for the obsmode (syn calcband/pysyn) |
| 31 |
calcphotCase.testthru |
| 32 |
|
| 33 |
- Compare the spectrum arrays in photlam (syn calcspec/pysyn) |
| 34 |
calcspecCase.testspecphotlam |
| 35 |
|
| 36 |
- Compare the resulting (spectrum through obsmode) arrays in photlam |
| 37 |
(syn calcspec/syn countrate/pysyn) |
| 38 |
countrateCase.testcsphotlam, countrateCase.testcrphotlam |
| 39 |
|
| 40 |
- Compare the resulting (spectrum through obsmode) arrays in counts |
| 41 |
(syn calcspec/syn countrate/pysyn) |
| 42 |
countrateCase.testcscounts, countrateCase.testcrcounts |
| 43 |
|
| 44 |
- Compare any scalar values calculated (countrate, efflam, ...) |
| 45 |
calcphotCase.testefflam |
| 46 |
countrateCase.testcountrate |
| 47 |
|
| 48 |
Array comparisons: |
| 49 |
|
| 50 |
Prior to r465, array comparisons were performed strictly, applying the |
| 51 |
same (pysyn-syn)/syn metric as for scalar elements to each element of |
| 52 |
the array. If any elements failed, then the test failed; the fraction |
| 53 |
of array elements that failed was compared to the superthreshold to |
| 54 |
determine extreme failures. |
| 55 |
|
| 56 |
This generated a large number of spurious failures because of |
| 57 |
differences between very small numbers in the domain where the |
| 58 |
spectrum was essentially zero. With r465, the array comparisons were |
| 59 |
performed only on "significant" array elements, where: |
| 60 |
- a "significant" element has a value at least SigThresh*max(array) |
| 61 |
- if the set of significant elements for the two arrays differs, |
| 62 |
the test fails |
| 63 |
- the (pysyn-syn)/syn comparison is performed only on the |
| 64 |
significant elements. |
| 65 |
|
| 66 |
The SigThresh was initially set to 0.005. |
| 67 |
|
| 68 |
Array comparisons will (eventually) be performed in two stages, so as |
| 69 |
to apply a looser acceptance criteria at locations that are likely to |
| 70 |
exhibit numerical discrepancies (eg, steep gradients, inflection |
| 71 |
points) and a tighter acceptance criteria elsewhere. |
| 72 |
|
| 73 |
Another possibility is to calculate the mean, std, and extrema of the |
| 74 |
difference array after some clipping has been applied |
| 75 |
|
| 76 |
|
| 77 |
Test results: |
| 78 |
|
| 79 |
Discrepancies greater than some pre-agreed percentage |
| 80 |
will be brought to the attention of the instrument teams. |
| 81 |
|
| 82 |
Some analysis will also be performed on the test results -- e.g., |
| 83 |
histogram of discrepancies, mean & std. The pass/fail discrepancy will |
| 84 |
probably be updated based on such analysis. |
| 85 |
|
| 86 |
|
| 87 |
Other comments: |
| 88 |
|
| 89 |
Waveset issues require special handling: |
| 90 |
- for COUNTRATE comparisons, both synphot and pysynphot will produce |
| 91 |
spectra (in counts) on the same optimally binned wavelength |
| 92 |
set. These can be compared directly. |
| 93 |
|
| 94 |
- for all other comparisons of flux arrays, the synphot and |
| 95 |
pysynphot calculations will be performed independently, each in |
| 96 |
their native wavesets. Then the waveset from the synphot spectrum |
| 97 |
will be used to sample the pysynphot spectrum, and those results |
| 98 |
will be compared. |
| 99 |
|
| 100 |
|
| 101 |
We may additionally wish to design some tests intended to validate the |
| 102 |
pysynphot native results. |
| 103 |
|
| 104 |
Both synphot and pysynphot use photlam as their native or internal |
| 105 |
units for calculations; thus making these comparisons will be |
| 106 |
informative. |
| 107 |
|
| 108 |
Calculations that are performed in counts are likely to show greater |
| 109 |
discrepancies than those in any other units, because in order to |
| 110 |
compute counts, one must integrate over wavelength (which implies |
| 111 |
multiplying by the bin size, which implies computing delta-wavelength, |
| 112 |
which is susceptible to very small numerical variations) and area |
| 113 |
(which implies multiplying by the area of the HST mirror, which will |
| 114 |
amplify those small variations). |
| 115 |
|