Skip to content

Commit

Permalink
the first line of CPython examples was cut off
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z committed Oct 19, 2019
1 parent e65e98f commit 062a9ac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
18 changes: 12 additions & 6 deletions docs/manual/source/ulab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ in ``numpy``.
numpy:
https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.flatten.htm

``.flatten`` returns the flattened array. The array can be flatten in
``.flatten`` returns the flattened array. The array can be flattened in
``C`` style (i.e., moving horizontally in the matrix), or in ``fortran``
style (i.e., moving vertically in the matrix). The ``C``-style
flattening is the default, and it is also fast, because this is just
flattening is the default, and it is also fast, because this is just a
verbatim copy of the contents.

.. code::
Expand Down Expand Up @@ -508,8 +508,8 @@ verbatim copy of the contents.
~~~~~~~~~~~~

The contents of an ``ndarray`` can be accessed directly by calling the
``.asbytearray`` method. This will return a pointer to the underlying
``array`` object, which can then be manipulated directly.
``.asbytearray`` method. This will simply return a pointer to the
underlying ``array`` object, which can then be manipulated directly.

**WARNING:** ``asbytearray`` is a ``ulab``-only method; it has no
equivalent in ``numpy``.
Expand Down Expand Up @@ -559,7 +559,9 @@ applied to the results of timed ADC conversions.
print("mean of results:\t", np.mean(a))
print("std of results:\t", np.std(a))
Likewise, data can be read directly into ``ndarray``\ s from other
interfaces, e.g., SPI, I2C etc.
interfaces, e.g., SPI, I2C etc, and also, by laying bare the
``ndarray``, we can pass results of ``ulab`` computations to anything
that can read from a buffer.

.transpose
~~~~~~~~~~
Expand Down Expand Up @@ -781,6 +783,7 @@ columns the matrix has. This feature will be added in future versions of
.. code::
# code to be run in CPython
a = array([[1, 2, 3], [4, 5, 6], [7, 8, 6]])
b = array([10, 20, 30])
a+b
Expand Down Expand Up @@ -1018,6 +1021,7 @@ use cases this fact should not make a difference.
.. code::
# code to be run in CPython
a = array([1, 2, 3, 4, 5, 6, 7, 8])
a < 5
Expand Down Expand Up @@ -1978,6 +1982,7 @@ The same matrix diagonalised with ``numpy`` yields:
.. code::
# code to be run in CPython
a = array([[1, 2, 1, 4], [2, 5, 3, 5], [1, 3, 6, 1], [4, 5, 1, 7]], dtype=np.uint8)
x, y = eig(a)
print('eigenvectors of a:\n', x)
print('\neigenvalues of a:\n', y)
Expand Down Expand Up @@ -2111,6 +2116,7 @@ it will be treated as a complex array:
.. code::
# code to be run in CPython
fft.fft([1, 2, 3, 4, 1, 2, 3, 4])
Expand Down Expand Up @@ -2610,4 +2616,4 @@ for the ``pyboard``.

.. code::
# code to be run in CPython
# code to be run in CPython
2 changes: 1 addition & 1 deletion docs/templates/manual.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{%- else -%}
.. code::

{{ '\n'.join(['# code to be run in CPython'] + cell.source.strip().split('\n')[1:]) | indent}}
{{ '\n'.join(['# code to be run in CPython'] + cell.source.strip().split('\n')) | indent}}
{%- endif -%}
{% endblock input %}

Expand Down
20 changes: 10 additions & 10 deletions docs/ulab-manual.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
},
{
"cell_type": "code",
"execution_count": 512,
"execution_count": 515,
"metadata": {
"ExecuteTime": {
"end_time": "2019-10-19T17:49:57.781782Z",
"start_time": "2019-10-19T17:49:54.892112Z"
"end_time": "2019-10-19T19:43:24.387588Z",
"start_time": "2019-10-19T19:43:20.965252Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -69,11 +69,11 @@
},
{
"cell_type": "code",
"execution_count": 502,
"execution_count": 514,
"metadata": {
"ExecuteTime": {
"end_time": "2019-10-19T13:38:27.980040Z",
"start_time": "2019-10-19T13:38:27.972434Z"
"end_time": "2019-10-19T19:43:16.101055Z",
"start_time": "2019-10-19T19:43:16.034165Z"
}
},
"outputs": [
Expand Down Expand Up @@ -107,7 +107,7 @@
"{%- else -%}\n",
".. code::\n",
"\n",
"{{ '\\n'.join(['# code to be run in CPython'] + cell.source.strip().split('\\n')[1:]) | indent}}\n",
"{{ '\\n'.join(['# code to be run in CPython'] + cell.source.strip().split('\\n')) | indent}}\n",
"{%- endif -%}\n",
"{% endblock input %}\n",
"\n",
Expand Down Expand Up @@ -889,7 +889,7 @@
"\n",
"numpy: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.flatten.htm\n",
"\n",
"`.flatten` returns the flattened array. The array can be flatten in `C` style (i.e., moving horizontally in the matrix), or in `fortran` style (i.e., moving vertically in the matrix). The `C`-style flattening is the default, and it is also fast, because this is just verbatim copy of the contents."
"`.flatten` returns the flattened array. The array can be flattened in `C` style (i.e., moving horizontally in the matrix), or in `fortran` style (i.e., moving vertically in the matrix). The `C`-style flattening is the default, and it is also fast, because this is just a verbatim copy of the contents."
]
},
{
Expand Down Expand Up @@ -940,7 +940,7 @@
"source": [
"### .asbytearray\n",
"\n",
"The contents of an `ndarray` can be accessed directly by calling the `.asbytearray` method. This will return a pointer to the underlying `array` object, which can then be manipulated directly.\n",
"The contents of an `ndarray` can be accessed directly by calling the `.asbytearray` method. This will simply return a pointer to the underlying `array` object, which can then be manipulated directly.\n",
"\n",
"**WARNING:** `asbytearray` is a `ulab`-only method; it has no equivalent in `numpy`."
]
Expand Down Expand Up @@ -1014,7 +1014,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Likewise, data can be read directly into `ndarray`s from other interfaces, e.g., SPI, I2C etc. "
"Likewise, data can be read directly into `ndarray`s from other interfaces, e.g., SPI, I2C etc, and also, by laying bare the `ndarray`, we can pass results of `ulab` computations to anything that can read from a buffer."
]
},
{
Expand Down

0 comments on commit 062a9ac

Please sign in to comment.