Repository: PennyLaneAI/pennylane
Pull request #2236 (2022-02-26 00:19:51)

Rename the `pennylane/measure.py` file to `pennylane/measurements.py`
**Context:**
In preparations to introduce the user interface for mid-circuit measurements (see https://github.com/PennyLaneAI/pennylane/pull/2211), we'd like to allow `qml.measure` to be an accessible name.

**Description of the Change:**

Carries out the `pennylane/measure.py` -> `pennylane/measurements.py` renaming.

**Benefits:**

`qml.measure` will be a vacant name to use and no conflicts arise.

**Possible Drawbacks:**

Minor: plugins or demos might be dependent on the renaming, however, no such occurrences have been found so far.

**Related GitHub Issues:**
N/A

github-actions[bot]: Hello. You may have forgotten to update the changelog!
Please edit [`doc/releases/changelog-dev.md`](/PennyLaneAI/pennylane/blob/master/doc/releases/changelog-dev.md) with:
* A one-to-two sentence description of the change. You may include a small working example for new features.
* A link back to this PR.
* Your name (or GitHub username) in the contributors section.
codecov[bot]: # [Codecov](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI) Report
> Merging [#2236](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI) (61060f0) into [master](https://codecov.io/gh/PennyLaneAI/pennylane/commit/9b61f17649c4b7c45dc3d66576e0727433726430?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI) (9b61f17) will **decrease** coverage by `2.71%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/graphs/tree.svg?width=650&height=150&src=pr&token=9S3YzlUgGk&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI)](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI)

```diff
@@            Coverage Diff             @@
##           master    #2236      +/-   ##
==========================================
- Coverage   99.26%   96.55%   -2.72%     
==========================================
  Files         231      231              
  Lines       18349    18349              
==========================================
- Hits        18215    17716     -499     
- Misses        134      633     +499     
```


| [Impacted Files](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI) | Coverage Δ | |
|---|---|---|
| [pennylane/measurements.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL21lYXN1cmVtZW50cy5weQ==) | `99.07% <ø> (ø)` | |
| [pennylane/transforms/hamiltonian\_expand.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL3RyYW5zZm9ybXMvaGFtaWx0b25pYW5fZXhwYW5kLnB5) | `100.00% <ø> (ø)` | |
| [pennylane/\_\_init\_\_.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | |
| [pennylane/\_device.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL19kZXZpY2UucHk=) | `97.98% <100.00%> (ø)` | |
| [pennylane/\_qubit\_device.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL19xdWJpdF9kZXZpY2UucHk=) | `98.40% <100.00%> (-0.32%)` | :arrow_down: |
| [pennylane/circuit\_graph.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL2NpcmN1aXRfZ3JhcGgucHk=) | `95.00% <100.00%> (ø)` | |
| [pennylane/drawer/representation\_resolver.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL2RyYXdlci9yZXByZXNlbnRhdGlvbl9yZXNvbHZlci5weQ==) | `99.43% <100.00%> (ø)` | |
| [pennylane/gradients/parameter\_shift.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL2dyYWRpZW50cy9wYXJhbWV0ZXJfc2hpZnQucHk=) | `100.00% <100.00%> (ø)` | |
| [pennylane/gradients/parameter\_shift\_cv.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL2dyYWRpZW50cy9wYXJhbWV0ZXJfc2hpZnRfY3YucHk=) | `99.16% <100.00%> (ø)` | |
| [pennylane/operation.py](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#diff-cGVubnlsYW5lL29wZXJhdGlvbi5weQ==) | `95.95% <100.00%> (ø)` | |
| ... and [29 more](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI). Last update [9b61f17...61060f0](https://codecov.io/gh/PennyLaneAI/pennylane/pull/2236?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI).

antalszava: Merging this as the codefactor issues are unrelated to this PR and are being addressed in #2258.

Patch:
diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md
index fff01b9d9..94159c35a 100644
--- a/doc/releases/changelog-dev.md
+++ b/doc/releases/changelog-dev.md
@@ -4,6 +4,13 @@
 
 <h3>New features since last release</h3>
 
+* Added the user-interface for mid-circuit measurements.
+  [(#2236)](https://github.com/PennyLaneAI/pennylane/pull/2236)
+
+* The text based drawer accessed via `qml.draw` has been overhauled. The new drawer has 
+  a `decimals` keyword for controlling parameter rounding, a different algorithm for determining positions, 
+  deprecation of the `charset` keyword, and minor cosmetic changes.
+
 * Transform a circuit from quantum tape, quantum function or quantum node to a pairwise
   commutation DAG (directed acyclic graph). The node represents the quantum operations, and the edges represent 
   non commutation between two operations.
@@ -51,6 +58,7 @@
   >>> second_node_predecessors = second_node.predecessors
   []
   ```
+
 * The text based drawer accessed via `qml.draw` has been overhauled.
   [(#2128)](https://github.com/PennyLaneAI/pennylane/pull/2128)
   [(#2198)](https://github.com/PennyLaneAI/pennylane/pull/2198)
diff --git a/pennylane/__init__.py b/pennylane/__init__.py
index 3362496ec..f9c1224cb 100644
--- a/pennylane/__init__.py
+++ b/pennylane/__init__.py
@@ -41,7 +41,7 @@ from pennylane.circuit_graph import CircuitGraph
 from pennylane.configuration import Configuration
 from pennylane.tracker import Tracker
 from pennylane.io import *
-from pennylane.measure import density_matrix, expval, probs, sample, state, var
+from pennylane.measurements import density_matrix, expval, probs, sample, state, var
 from pennylane.ops import *
 from pennylane.templates import broadcast, layer
 from pennylane.templates.embeddings import *
diff --git a/pennylane/_device.py b/pennylane/_device.py
index 1081e995c..fce6241d6 100644
--- a/pennylane/_device.py
+++ b/pennylane/_device.py
@@ -895,7 +895,7 @@ class Device(abc.ABC):
                 )
 
         for o in observables:
-            if isinstance(o, qml.measure.MeasurementProcess) and o.obs is not None:
+            if isinstance(o, qml.measurements.MeasurementProcess) and o.obs is not None:
                 o = o.obs
 
             if isinstance(o, Tensor):
diff --git a/pennylane/_qubit_device.py b/pennylane/_qubit_device.py
index f15470891..450f56210 100644
--- a/pennylane/_qubit_device.py
+++ b/pennylane/_qubit_device.py
@@ -38,7 +38,7 @@ from pennylane import Device
 from pennylane.math import sum as qmlsum
 from pennylane.wires import Wires
 
-from pennylane.measure import MeasurementProcess
+from pennylane.measurements import MeasurementProcess
 
 
 class QubitDevice(Device):
diff --git a/pennylane/circuit_graph.py b/pennylane/circuit_graph.py
index 31e60997f..91ed4a588 100644
--- a/pennylane/circuit_graph.py
+++ b/pennylane/circuit_graph.py
@@ -77,7 +77,7 @@ def _is_returned_observable(op):
         bool: whether or not the observable or measurement process is in the
         return statement
     """
-    is_obs = isinstance(op, (qml.operation.Observable, qml.measure.MeasurementProcess))
+    is_obs = isinstance(op, (qml.operation.Observable, qml.measurements.MeasurementProcess))
     return is_obs and op.return_type is not None
 
 
@@ -151,11 +151,11 @@ class CircuitGraph:
                     # State measurements contain no wires by default, but wires are
                     # required for the circuit drawer, so we recreate the state
                     # measurement with all wires
-                    op = qml.measure.MeasurementProcess(qml.operation.State, wires=wires)
+                    op = qml.measurements.MeasurementProcess(qml.operation.State, wires=wires)
 
                 elif op.return_type is qml.operation.Sample and op.wires == Wires([]):
                     # Sampling without specifying wires is treated as sampling all wires
-                    op = qml.measure.MeasurementProcess(qml.operation.Sample, wires=wires)
+                    op = qml.measurements.MeasurementProcess(qml.operation.Sample, wires=wires)
 
                 op.queue_idx = k
 
@@ -506,7 +506,9 @@ class CircuitGraph:
             operations[wire] = list(
                 filter(
                     lambda op: not (
-                        isinstance(op, (qml.operation.Observable, qml.measure.MeasurementProcess))
+                        isinstance(
+                            op, (qml.operation.Observable, qml.measurements.MeasurementProcess)
+                        )
                         and op.return_type is not None
                     ),
                     operations[wire],
@@ -540,7 +542,7 @@ class CircuitGraph:
                 observables[wire] = list(
                     filter(
                         lambda op: isinstance(
-                            op, (qml.operation.Observable, qml.measure.MeasurementProcess)
+                            op, (qml.operation.Observable, qml.measurements.MeasurementProcess)
                         )
                         and op.return_type is not None,
                         self._grid[wire],
diff --git a/pennylane/drawer/representation_resolver.py b/pennylane/drawer/representation_resolver.py
index 949482a5c..ccf9a3d22 100644
--- a/pennylane/drawer/representation_resolver.py
+++ b/pennylane/drawer/representation_resolver.py
@@ -328,7 +328,7 @@ class RepresentationResolver:
         Returns:
             str: String representation of the Operator
         """
-        if isinstance(op, qml.measure.MeasurementProcess):
+        if isinstance(op, qml.measurements.MeasurementProcess):
             if op.obs is not None:
                 op = op.obs
             else:
@@ -511,7 +511,7 @@ class RepresentationResolver:
         if isinstance(element, str):
             return element
         if (
-            isinstance(element, (qml.operation.Observable, qml.measure.MeasurementProcess))
+            isinstance(element, (qml.operation.Observable, qml.measurements.MeasurementProcess))
             and element.return_type is not None
         ):
             return self.output_representation(element, wire)
diff --git a/pennylane/gradients/parameter_shift.py b/pennylane/gradients/parameter_shift.py
index 120bd956c..4cd1401dc 100644
--- a/pennylane/gradients/parameter_shift.py
+++ b/pennylane/gradients/parameter_shift.py
@@ -317,7 +317,7 @@ def var_param_shift(tape, argnum, shifts=None, gradient_recipes=None, f0=None):
     # Convert all variance measurements on the tape into expectation values
     for i in var_idx:
         obs = expval_tape._measurements[i].obs
-        expval_tape._measurements[i] = qml.measure.MeasurementProcess(
+        expval_tape._measurements[i] = qml.measurements.MeasurementProcess(
             qml.operation.Expectation, obs=obs
         )
 
@@ -357,7 +357,7 @@ def var_param_shift(tape, argnum, shifts=None, gradient_recipes=None, f0=None):
             # We need to calculate d<A^2>/dp; to do so, we replace the
             # involutory observables A in the queue with A^2.
             obs = _square_observable(expval_sq_tape._measurements[i].obs)
-            expval_sq_tape._measurements[i] = qml.measure.MeasurementProcess(
+            expval_sq_tape._measurements[i] = qml.measurements.MeasurementProcess(
                 qml.operation.Expectation, obs=obs
             )
 
diff --git a/pennylane/gradients/parameter_shift_cv.py b/pennylane/gradients/parameter_shift_cv.py
index 66ef1ad71..8b48081d1 100644
--- a/pennylane/gradients/parameter_shift_cv.py
+++ b/pennylane/gradients/parameter_shift_cv.py
@@ -215,7 +215,7 @@ def var_param_shift(tape, dev_wires, argnum=None, shifts=None, gradient_recipes=
     # Convert all variance measurements on the tape into expectation values
     for i in var_idx:
         obs = expval_tape._measurements[i].obs
-        expval_tape._measurements[i] = qml.measure.MeasurementProcess(
+        expval_tape._measurements[i] = qml.measurements.MeasurementProcess(
             qml.operation.Expectation, obs=obs
         )
 
@@ -245,7 +245,7 @@ def var_param_shift(tape, dev_wires, argnum=None, shifts=None, gradient_recipes=
         # with itself, to get a square symmetric matrix representing
         # the square of the observable
         obs = qml.PolyXP(np.outer(A, A), wires=obs.wires)
-        expval_sq_tape._measurements[i] = qml.measure.MeasurementProcess(
+        expval_sq_tape._measurements[i] = qml.measurements.MeasurementProcess(
             qml.operation.Expectation, obs=obs
         )
 
@@ -402,7 +402,7 @@ def second_order_param_shift(tape, dev_wires, argnum=None, shifts=None, gradient
 
             constants.append(constant)
 
-            g_tape._measurements[idx] = qml.measure.MeasurementProcess(
+            g_tape._measurements[idx] = qml.measurements.MeasurementProcess(
                 qml.operation.Expectation, _transform_observable(obs, Z, dev_wires)
             )
 
diff --git a/pennylane/measure.py b/pennylane/measurements.py
similarity index 100%
rename from pennylane/measure.py
rename to pennylane/measurements.py
diff --git a/pennylane/operation.py b/pennylane/operation.py
index 07bdce4ab..62250b0d5 100644
--- a/pennylane/operation.py
+++ b/pennylane/operation.py
@@ -2443,7 +2443,7 @@ def has_unitary_gen(obj):
 @qml.BooleanFn
 def is_measurement(obj):
     """Returns ``True`` if an operator is a ``MeasurementProcess`` instance."""
-    return isinstance(obj, qml.measure.MeasurementProcess)
+    return isinstance(obj, qml.measurements.MeasurementProcess)
 
 
 @qml.BooleanFn
diff --git a/pennylane/qnode.py b/pennylane/qnode.py
index 0a0a7da27..4cfb0201d 100644
--- a/pennylane/qnode.py
+++ b/pennylane/qnode.py
@@ -495,7 +495,9 @@ class QNode:
         else:
             measurement_processes = self._qfunc_output
 
-        if not all(isinstance(m, qml.measure.MeasurementProcess) for m in measurement_processes):
+        if not all(
+            isinstance(m, qml.measurements.MeasurementProcess) for m in measurement_processes
+        ):
             raise qml.QuantumFunctionError(
                 "A quantum function must return either a single measurement, "
                 "or a nonempty sequence of measurements."
diff --git a/pennylane/qnode_old.py b/pennylane/qnode_old.py
index 3ebc201f7..45196ac0a 100644
--- a/pennylane/qnode_old.py
+++ b/pennylane/qnode_old.py
@@ -586,7 +586,9 @@ class QNode:
         else:
             measurement_processes = self.qfunc_output
 
-        if not all(isinstance(m, qml.measure.MeasurementProcess) for m in measurement_processes):
+        if not all(
+            isinstance(m, qml.measurements.MeasurementProcess) for m in measurement_processes
+        ):
             raise qml.QuantumFunctionError(
                 "A quantum function must return either a single measurement, "
                 "or a nonempty sequence of measurements."
diff --git a/pennylane/tape/cv_param_shift.py b/pennylane/tape/cv_param_shift.py
index 8ab80a0c4..82949a0cf 100644
--- a/pennylane/tape/cv_param_shift.py
+++ b/pennylane/tape/cv_param_shift.py
@@ -24,7 +24,7 @@ import warnings
 import numpy as np
 
 import pennylane as qml
-from pennylane.measure import MeasurementProcess
+from pennylane.measurements import MeasurementProcess
 from pennylane.tape import QuantumTape
 
 from .qubit_param_shift import QubitParamShiftTape
diff --git a/pennylane/tape/qubit_param_shift.py b/pennylane/tape/qubit_param_shift.py
index 25b276292..f5cb9452b 100644
--- a/pennylane/tape/qubit_param_shift.py
+++ b/pennylane/tape/qubit_param_shift.py
@@ -22,7 +22,7 @@ and any gate with an involutory generator.
 import numpy as np
 
 import pennylane as qml
-from pennylane.measure import MeasurementProcess
+from pennylane.measurements import MeasurementProcess
 from pennylane.tape import QuantumTape
 from pennylane.math import toarray
 
diff --git a/pennylane/tape/tape.py b/pennylane/tape/tape.py
index 1fe3607ce..5ba28aa92 100644
--- a/pennylane/tape/tape.py
+++ b/pennylane/tape/tape.py
@@ -172,7 +172,7 @@ def expand_tape(tape, depth=1, stop_at=None, expand_measurements=False):
         tape._ops.extend(rotations)
 
         for o, i in zip(diag_obs, tape._obs_sharing_wires_id):
-            new_m = qml.measure.MeasurementProcess(tape.measurements[i].return_type, obs=o)
+            new_m = qml.measurements.MeasurementProcess(tape.measurements[i].return_type, obs=o)
             tape._measurements[i] = new_m
 
     for queue in ("_prep", "_ops", "_measurements"):
@@ -183,7 +183,7 @@ def expand_tape(tape, depth=1, stop_at=None, expand_measurements=False):
             if not expand_measurements:
                 # Measurements should not be expanded; treat measurements
                 # as a stopping condition
-                stop = stop or isinstance(obj, qml.measure.MeasurementProcess)
+                stop = stop or isinstance(obj, qml.measurements.MeasurementProcess)
 
             if stop:
                 # do not expand out the object; append it to the
@@ -191,7 +191,7 @@ def expand_tape(tape, depth=1, stop_at=None, expand_measurements=False):
                 getattr(new_tape, queue).append(obj)
                 continue
 
-            if isinstance(obj, (qml.operation.Operation, qml.measure.MeasurementProcess)):
+            if isinstance(obj, (qml.operation.Operation, qml.measurements.MeasurementProcess)):
                 # Object is an operation; query it for its expansion
                 try:
                     obj = obj.expand()
@@ -434,7 +434,7 @@ class QuantumTape(AnnotatedQueue):
                 else:
                     self._ops.append(obj)
 
-            elif isinstance(obj, qml.measure.MeasurementProcess):
+            elif isinstance(obj, qml.measurements.MeasurementProcess):
                 # measurement process
                 self._measurements.append(obj)
 
diff --git a/pennylane/transforms/hamiltonian_expand.py b/pennylane/transforms/hamiltonian_expand.py
index 127fc9789..548f46f2f 100644
--- a/pennylane/transforms/hamiltonian_expand.py
+++ b/pennylane/transforms/hamiltonian_expand.py
@@ -123,7 +123,7 @@ def hamiltonian_expand(tape, group=True):
     if (
         not isinstance(hamiltonian, qml.Hamiltonian)
         or len(tape.measurements) > 1
-        or tape.measurements[0].return_type != qml.measure.Expectation
+        or tape.measurements[0].return_type != qml.measurements.Expectation
     ):
         raise ValueError(
             "Passed tape must end in `qml.expval(H)`, where H is of type `qml.Hamiltonian`"
diff --git a/pennylane/transforms/qcut.py b/pennylane/transforms/qcut.py
index c74138b54..8e21f369c 100644
--- a/pennylane/transforms/qcut.py
+++ b/pennylane/transforms/qcut.py
@@ -30,7 +30,7 @@ from networkx import MultiDiGraph, weakly_connected_components
 import pennylane as qml
 from pennylane import apply, expval
 from pennylane.grouping import string_to_pauli_word
-from pennylane.measure import MeasurementProcess
+from pennylane.measurements import MeasurementProcess
 from pennylane.operation import Expectation, Operation, Operator, Tensor
 from pennylane.ops.qubit.non_parametric_ops import WireCut
 from pennylane.tape import QuantumTape


Test patch:
diff --git a/tests/circuit_graph/test_circuit_graph.py b/tests/circuit_graph/test_circuit_graph.py
index 6b7803fae..483b8031e 100644
--- a/tests/circuit_graph/test_circuit_graph.py
+++ b/tests/circuit_graph/test_circuit_graph.py
@@ -119,7 +119,7 @@ def lst_mp_equality(lst1, lst2):
         if not isinstance(lst1[index], type(lst2[index])):  # if they are different types
             return False  # then return false
 
-        elif isinstance(lst1[index], qml.measure.MeasurementProcess):
+        elif isinstance(lst1[index], qml.measurements.MeasurementProcess):
             lsts_same = lsts_same and measurement_process_equality(lst1[index], lst2[index])
 
         else:
@@ -308,13 +308,13 @@ class TestCircuitGraph:
         none are explicitly provided."""
 
         ops = [qml.Hadamard(wires=0), qml.CNOT(wires=[0, 1])]
-        obs_no_wires = [qml.measure.sample(op=None, wires=None)]
-        obs_w_wires = [qml.measure.sample(op=None, wires=[0, 1, 2])]
+        obs_no_wires = [qml.measurements.sample(op=None, wires=None)]
+        obs_w_wires = [qml.measurements.sample(op=None, wires=[0, 1, 2])]
 
         circuit_no_wires = CircuitGraph(ops, obs_no_wires, wires=Wires([0, 1, 2]))
         circuit_w_wires = CircuitGraph(ops, obs_w_wires, wires=Wires([0, 1, 2]))
 
-        sample_w_wires_op = qml.measure.sample(op=None, wires=[0, 1, 2])
+        sample_w_wires_op = qml.measurements.sample(op=None, wires=[0, 1, 2])
         expected_grid = {
             0: [ops[0], ops[1], sample_w_wires_op],
             1: [ops[1], sample_w_wires_op],
diff --git a/tests/devices/test_caching.py b/tests/devices/test_caching.py
index 7ce56954f..60b554b4a 100644
--- a/tests/devices/test_caching.py
+++ b/tests/devices/test_caching.py
@@ -15,7 +15,7 @@
 import pytest
 
 import pennylane as qml
-from pennylane.measure import expval
+from pennylane.measurements import expval
 from pennylane import qnode, QNode
 from pennylane.devices import DefaultQubit
 from pennylane import numpy as np
diff --git a/tests/drawer/test_circuit_drawer.py b/tests/drawer/test_circuit_drawer.py
index 8e2d3bb92..d9976c016 100644
--- a/tests/drawer/test_circuit_drawer.py
+++ b/tests/drawer/test_circuit_drawer.py
@@ -25,7 +25,7 @@ from pennylane.drawer.grid import Grid, _transpose
 from pennylane.drawer.charsets import CHARSETS, UnicodeCharSet, AsciiCharSet
 from pennylane.wires import Wires
 
-from pennylane.measure import state
+from pennylane.measurements import state
 
 
 class TestFunctions:
diff --git a/tests/drawer/test_representation_resolver.py b/tests/drawer/test_representation_resolver.py
index bb5ba76d6..f53aaa6d1 100644
--- a/tests/drawer/test_representation_resolver.py
+++ b/tests/drawer/test_representation_resolver.py
@@ -20,7 +20,7 @@ import numpy as np
 
 import pennylane as qml
 from pennylane.drawer.representation_resolver import RepresentationResolver
-from pennylane.measure import state
+from pennylane.measurements import state
 
 
 @pytest.fixture
@@ -211,8 +211,8 @@ class TestRepresentationResolver:
             (qml.Toffoli(wires=[0, 2, 1]).inv(), 1, "X⁻¹"),
             (qml.Toffoli(wires=[0, 2, 1]).inv(), 0, "C"),
             (qml.Toffoli(wires=[0, 2, 1]).inv(), 2, "C"),
-            (qml.measure.sample(wires=[0, 1]), 0, "basis"),  # not providing an observable in
-            (qml.measure.sample(wires=[0, 1]), 1, "basis"),  # sample gets displayed as raw
+            (qml.measurements.sample(wires=[0, 1]), 0, "basis"),  # not providing an observable in
+            (qml.measurements.sample(wires=[0, 1]), 1, "basis"),  # sample gets displayed as raw
             (two_wire_quantum_tape(), 0, "QuantumTape:T0"),
             (two_wire_quantum_tape(), 1, "QuantumTape:T0"),
         ],
@@ -355,8 +355,8 @@ class TestRepresentationResolver:
             (qml.Toffoli(wires=[0, 2, 1]).inv(), 1, "X^-1"),
             (qml.Toffoli(wires=[0, 2, 1]).inv(), 0, "C"),
             (qml.Toffoli(wires=[0, 2, 1]).inv(), 2, "C"),
-            (qml.measure.sample(wires=[0, 1]), 0, "basis"),  # not providing an observable in
-            (qml.measure.sample(wires=[0, 1]), 1, "basis"),  # sample gets displayed as raw
+            (qml.measurements.sample(wires=[0, 1]), 0, "basis"),  # not providing an observable in
+            (qml.measurements.sample(wires=[0, 1]), 1, "basis"),  # sample gets displayed as raw
             (two_wire_quantum_tape(), 0, "QuantumTape:T0"),
             (two_wire_quantum_tape(), 1, "QuantumTape:T0"),
         ],
diff --git a/tests/tape/test_tape.py b/tests/tape/test_tape.py
index 902b5b1e9..35a2a538b 100644
--- a/tests/tape/test_tape.py
+++ b/tests/tape/test_tape.py
@@ -22,7 +22,7 @@ import pytest
 import pennylane as qml
 from pennylane import CircuitGraph
 from pennylane.tape import QuantumTape
-from pennylane.measure import MeasurementProcess, expval, sample, var
+from pennylane.measurements import MeasurementProcess, expval, sample, var
 
 
 def TestOperationMonkeypatching():
diff --git a/tests/test_measure.py b/tests/test_measure.py
index d67bcc157..8eccb668f 100644
--- a/tests/test_measure.py
+++ b/tests/test_measure.py
@@ -22,7 +22,7 @@ from pennylane.devices import DefaultQubit
 from pennylane.operation import DecompositionUndefinedError
 
 from pennylane.queuing import AnnotatedQueue
-from pennylane.measure import (
+from pennylane.measurements import (
     expval,
     var,
     sample,
diff --git a/tests/test_qubit_device.py b/tests/test_qubit_device.py
index 5c4738a1d..97b6f48f5 100644
--- a/tests/test_qubit_device.py
+++ b/tests/test_qubit_device.py
@@ -25,7 +25,7 @@ from pennylane.operation import Sample, Variance, Expectation, Probability, Stat
 from pennylane.circuit_graph import CircuitGraph
 from pennylane.wires import Wires
 from pennylane.tape import QuantumTape
-from pennylane.measure import state
+from pennylane.measurements import state
 
 mock_qubit_device_paulis = ["PauliX", "PauliY", "PauliZ"]
 mock_qubit_device_rotations = ["RX", "RY", "RZ"]
@@ -268,7 +268,7 @@ class TestObservables:
 
         with qml.tape.QuantumTape() as tape:
             qml.PauliX(wires=0)
-            qml.measure.MeasurementProcess(
+            qml.measurements.MeasurementProcess(
                 return_type="SomeUnsupportedReturnType", obs=qml.PauliZ(0)
             )
 
@@ -615,7 +615,7 @@ class TestSample:
     ):
         """Test that when we sample a device without providing an observable or wires then it
         will return the raw samples"""
-        obs = qml.measure.sample(op=None, wires=None)
+        obs = qml.measurements.sample(op=None, wires=None)
         dev = mock_qubit_device_with_original_statistics(wires=2)
         generated_samples = np.array([[1, 0], [1, 1]])
         dev._samples = generated_samples
@@ -628,7 +628,7 @@ class TestSample:
     ):
         """Test that when we sample a device without providing an observable but we specify
         wires then it returns the generated samples for only those wires"""
-        obs = qml.measure.sample(op=None, wires=[1])
+        obs = qml.measurements.sample(op=None, wires=[1])
         dev = mock_qubit_device_with_original_statistics(wires=2)
         generated_samples = np.array([[1, 0], [1, 1]])
         dev._samples = generated_samples
diff --git a/tests/transforms/test_qcut.py b/tests/transforms/test_qcut.py
index 5863af81b..d182cd5c5 100644
--- a/tests/transforms/test_qcut.py
+++ b/tests/transforms/test_qcut.py
@@ -1053,7 +1053,7 @@ class TestGetMeasurements:
         out = qcut._get_measurements(group, meas)
 
         assert len(out) == len(group)
-        assert out[0].return_type is qml.measure.Expectation
+        assert out[0].return_type is qml.measurements.Expectation
         assert out[0].obs.name == "Identity"
         assert out[0].obs.wires[0] == 0
 
@@ -1065,7 +1065,10 @@ class TestGetMeasurements:
         out = qcut._get_measurements(group, meas)
 
         assert len(out) == 2
-        assert [o.return_type for o in out] == [qml.measure.Expectation, qml.measure.Expectation]
+        assert [o.return_type for o in out] == [
+            qml.measurements.Expectation,
+            qml.measurements.Expectation,
+        ]
 
         obs = [o.obs for o in out]