Three pressure sensors each produce readings in three trials. Rows of raw represent sensors A, B and C; columns represent trials. All readings and offsets are in kilopascals.
The intended calibration subtracts 2 kPa from every reading of sensor A, 1 kPa from every reading of sensor B, and 4 kPa from every reading of sensor C. An analyst runs this code:
import numpy as np raw = np.array([[12.0, 17.0, 24.0], [14.0, 21.0, 29.0], [18.0, 25.0, 31.0]]) offsets = np.array([2.0, 1.0, 4.0]) corrected = raw - offsets keep = (corrected >= 16.0) & (corrected < 25.0) selected = corrected[keep]
Determine how many entries of corrected differ from the intended calibration, how many readings selected actually contains, and the mean of selected. Enter both counts as exact integers and the mean in kPa to one decimal place. Trace the code as written.
Unlock full course notes by signing up
Locate readings across three axes
Pressure readings in kPa are arranged with axes representing experiment, time, and sensor, in that order. The code uses the default reshape order. Find the readings returned by p[1, 0, 2] and p[0, -1, -1]. Enter each answer in kPa, to zero decimal places.
Translate a requested region into a slice
A measurement array a has shape (7, 8). You need rows with indices 1, 2, 3, and 4, and columns with indices 0, 3, and 6. Complete the parameter values for the following selection, using positive integers.
The value of row_stop is ________, and the value of column_step is ________.
Average measurements along the intended axis
Two experimental runs record energy measurements from detectors A, B and C. Rows represent runs, columns represent detectors, and every entry is in joules.
Complete the table with the numerical values produced by this code. Enter exact integers in joules.
Trace edits through shared array data
An engineer extracts a region of an integer array and saves a separate snapshot before editing the data. After all statements below execute in order, which statements are true? Select every true statement.