コード例 #1
0
 def test_get_quantile_fails(self, stat_segy):
     """`get_quantile` must fail if survey stats were not collected."""
     path, _ = stat_segy
     survey = Survey(path,
                     header_index="TRACE_SEQUENCE_FILE",
                     header_cols="offset")
     with pytest.raises(ValueError):
         survey.get_quantile(0.5)
コード例 #2
0
 def test_get_quantile(self, stat_segy, quantile, is_scalar):
     """Run `get_quantile` and check the returned value and its type."""
     path, _ = stat_segy
     survey = Survey(path,
                     header_index="TRACE_SEQUENCE_FILE",
                     header_cols="offset")
     survey.mark_dead_traces()
     survey.collect_stats()
     quantile_val = survey.get_quantile(quantile)
     assert np.isscalar(quantile) is is_scalar
     assert np.allclose(
         np.array(quantile_val).ravel(),
         survey.quantile_interpolator(quantile))