<commit_before>ND-Data
=======

.. _numpy: http://numpy.org

.. _nddata-summary-label:

.. pulled this from generated/pyspsecdata.nddata.rst
.. add :toctree: to autosummary so stubs are generated
.. remove __init__ method at the top

(This is an introduction.  For detailed info, see :class:`API documentation <pyspecdata.nddata>`.)

The nddata class is built on top of numpy_.
Numpy allows you to create multi-dimensional arrays of data.
The nddata class labels the dimensions (with a short text identifier)
and allows you to associate
axes, units, and errors with the data.
These attributes
*are correctly transformed* when you perform arithmetic operations
or Fourier transforms,
and are used to automatically format plots.

.. todo::
    also implement with blocks for working in the Fourier domain

Very importantly, most pyspecdata functions are designed to operate on the data *in place*, meaning that
rather than doing something like:

>>> data = data.mean() # numpy

you simply do:

>>> data.mean('axisname')<commit_msg>Adding numpy --> nddata example.<commit_after>ND-Data
=======

.. _numpy: http://numpy.org

.. _nddata-summary-label:

.. pulled this from generated/pyspsecdata.nddata.rst
.. add :toctree: to autosummary so stubs are generated
.. remove __init__ method at the top

(This is an introduction.  For detailed info, see :class:`API documentation <pyspecdata.nddata>`.)

The nddata class is built on top of numpy_.
Numpy allows you to create multi-dimensional arrays of data.
For example, take the following 2D array, representing the x and y dimensions of a plot:
>>> C = np.r_[[0,1,2,3,4,5],[0,0.1,0.2,0.3,0.4,0.5]]
[[0  1   2   3   4   5]
 [0  0.1 0.2 0.3 0.4 0.5]]
To transform this into a numpy array, we form nddata out of the y-axis and add an axis
label comprised of the x-axis:
>>> Cdata = nddata(C[0],'x').labels('x',C[1])
[0, 1, 2, 3, 4, 5]
          +/-None
   dimlabels=['x']
   axes={'x':[0, 0.1, 0.2, 0.3,
0.4, 0.5]
                    +/-None

The nddata class labels the dimensions (with a short text identifier)
and allows you to associate
axes, units, and errors with the data.
These attributes
*are correctly transformed* when you perform arithmetic operations
or Fourier transforms,
and are used to automatically format plots.

.. todo::
    also implement with blocks for working in the Fourier domain

Very importantly, most pyspecdata functions are designed to operate on the data *in place*, meaning that
rather than doing something like:

>>> data = data.mean() # numpy

you simply do:

>>> data.mean('axisname')
{'fraction_non_alphanumeric': 0.10581803982819211, 'fraction_numerical': 0.021085513471300273, 'mean_word_length': 3.824858757062147, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3664333', 'n_tokens_mistral': 813, 'n_tokens_neox': 781, 'n_words': 338}