diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index efb8ba8..8b8c736 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -1,4 +1,4 @@ -name: Testing +name: Unit Tests on: push: branches: [ "master" ] diff --git a/Documentation/examples.rst b/Documentation/examples.rst index fe688a5..4658f99 100644 --- a/Documentation/examples.rst +++ b/Documentation/examples.rst @@ -154,3 +154,21 @@ the ``animate_spectrum()`` function. This will show the changes in the spectrum .. figure:: figs/spectrum-animated.gif Output Spectrum + +Converting to CSV +================= + +Sometimes, you just want to extract the data from the file so it can be processed by another program. Unfortunately, the +library provides no way of doing that natively, however, it is fairly easy to do yourself: + +.. code-block:: python + + from shr_parser import ShrFileParser + import numpy as np + import csv + with ShrFileParser('foo.shr') as parser: + sweeps = parser.get_all_sweeps() + sweeps = [sweep.sweep for sweep in sweeps] + with open('output.csv', 'w') as f: + writer = csv.writer(f) + writer.writerows(np.vstack(sweeps).tolist()) diff --git a/README.rst b/README.rst index 2922177..08a6839 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,6 @@ -=========================== -py-shr-parser -=========================== +============================== +py-shr-parser |Unit Testing| +============================== Overview -------- @@ -37,3 +37,7 @@ This shows how to open an SHR file and load all the sweep data. sweeps = parser.get_all_sweeps() The above example is very basic. For more advanced examples, please refer to the Documentation. + +.. |Unit Testing| image:: https://github.com/WiseLabCMU/py-shr-parser/actions/workflows/unittest.yml/badge.svg + :target: https://github.com/WiseLabCMU/py-shr-parser/actions/workflows/unittest.yml + :alt: Test Status