diff options
author | Timothy Knight <tknight@google.com> | 2014-10-11 11:38:50 -0700 |
---|---|---|
committer | Timothy Knight <tknight@google.com> | 2014-10-11 11:38:50 -0700 |
commit | efa9ed3c6f511dd472848dab6e145384087887a4 (patch) | |
tree | afa314ca8ac31f82d56d5bf26f6d7dedfd786404 /apps | |
parent | 1d249d8b1ca8eb6458971a8e81a718c8cbbe1543 (diff) | |
download | pdk-efa9ed3c6f511dd472848dab6e145384087887a4.tar.gz |
CameraITS: Fixed some test TODOs
Change-Id: Ia71d3ae76a4495aac157e081d283ab2e3900d355
Diffstat (limited to 'apps')
4 files changed, 20 insertions, 12 deletions
diff --git a/apps/CameraITS/tests/scene0/test_capture_result_dump.py b/apps/CameraITS/tests/scene0/test_capture_result_dump.py index 40c3e45..449314f 100644 --- a/apps/CameraITS/tests/scene0/test_capture_result_dump.py +++ b/apps/CameraITS/tests/scene0/test_capture_result_dump.py @@ -27,8 +27,8 @@ def main(): with its.device.ItsSession() as cam: # Arbitrary capture request exposure values; image content is not # important for this test, only the metadata. - # TODO: Update test to ensure manual settings are within legal ranges. - req = its.objects.manual_capture_request(100, 10*1000*1000) + props = cam.get_camera_properties() + req,_ = its.objects.get_fastest_manual_capture_settings(props) req["android.statistics.lensShadingMapMode"] = 1 cap = cam.do_capture(req, cam.CAP_YUV) pprint.pprint(cap["metadata"]) diff --git a/apps/CameraITS/tests/scene0/test_gyro_bias.py b/apps/CameraITS/tests/scene0/test_gyro_bias.py index 47e7f32..d0c41ce 100644 --- a/apps/CameraITS/tests/scene0/test_gyro_bias.py +++ b/apps/CameraITS/tests/scene0/test_gyro_bias.py @@ -33,10 +33,14 @@ def main(): # Number of samples averaged together, in the plot. N = 20 + # Pass/fail thresholds for gyro drift + MEAN_THRESH = 0.01 + VAR_THRESH = 0.001 + with its.device.ItsSession() as cam: print "Collecting gyro events" cam.start_sensor_events() - time.sleep(10) + time.sleep(5) gyro_events = cam.get_sensor_events()["gyro"] nevents = (len(gyro_events) / N) * N @@ -46,6 +50,9 @@ def main(): xs = numpy.array([e["x"] for e in gyro_events]) ys = numpy.array([e["y"] for e in gyro_events]) zs = numpy.array([e["z"] for e in gyro_events]) + + # Group samples into size-N groups and average each together, to get rid + # of individual rnadom spikes in the data. times = times[N/2::N] xs = xs.reshape(nevents/N, N).mean(1) ys = ys.reshape(nevents/N, N).mean(1) @@ -59,7 +66,9 @@ def main(): pylab.legend() matplotlib.pyplot.savefig("%s_plot.png" % (NAME)) - # TODO: Add pass/fail check. + for samples in [xs,ys,zs]: + assert(samples.mean() < MEAN_THRESH) + assert(numpy.var(samples) < VAR_THRESH) if __name__ == '__main__': main() diff --git a/apps/CameraITS/tests/scene0/test_metadata.py b/apps/CameraITS/tests/scene0/test_metadata.py index 57d0aac..41abe90 100644 --- a/apps/CameraITS/tests/scene0/test_metadata.py +++ b/apps/CameraITS/tests/scene0/test_metadata.py @@ -32,8 +32,7 @@ def main(): # Arbitrary capture request exposure values; image content is not # important for this test, only the metadata. props = cam.get_camera_properties() - # TODO: Update test to ensure manual settings are within legal ranges. - req = its.objects.manual_capture_request(100, 10*1000*1000) + req,_ = its.objects.get_fastest_manual_capture_settings(props) cap = cam.do_capture(req, cam.CAP_YUV) md = cap["metadata"] diff --git a/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py b/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py index f906287..93accf1 100644 --- a/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py +++ b/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py @@ -33,14 +33,14 @@ def main(): props = cam.get_camera_properties() sens_range = props['android.sensor.info.sensitivityRange'] sens_step = (sens_range[1] - sens_range[0]) / NUM_STEPS - sensitivities = range(sens_range[0], sens_range[1], sens_step) - # TODO: Update test to ensure manual settings are within legal ranges. - reqs = [its.objects.manual_capture_request(s,10*1000*1000) - for s in sensitivities] + sens_list = range(sens_range[0], sens_range[1], sens_step) + e = min(props['android.sensor.info.exposureTimeRange']) + reqs = [its.objects.manual_capture_request(s,e) for s in sens_list] + _,fmt = its.objects.get_fastest_manual_capture_settings(props) - caps = cam.do_capture(reqs) + caps = cam.do_capture(reqs, fmt) for i,cap in enumerate(caps): - s_req = sensitivities[i] + s_req = sens_list[i] s_res = cap["metadata"]["android.sensor.sensitivity"] assert(s_req == s_res) |