From ab38fd872208e0664c5c259e21977900bf9c65d1 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 12:12:34 -0400 Subject: [PATCH 1/3] Add example for converting to CSV --- Documentation/examples.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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()) From dbdff7f2c5dcccc9f016ab6d7a7dc9defb949f6f Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 12:26:06 -0400 Subject: [PATCH 2/3] Add a badge for testing --- README.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 From af5c363104e2eeb16ce3ccc8a8cc9667193fc803 Mon Sep 17 00:00:00 2001 From: Tom Schmitz Date: Mon, 28 Jul 2025 12:27:45 -0400 Subject: [PATCH 3/3] Rename workflow --- .github/workflows/unittest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" ]