Skip to content

Commit aa5cd6b

Browse files
authored
Docs (#4)
* Add example for converting to CSV * Add a badge for testing * Rename workflow
1 parent cb469ce commit aa5cd6b

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Testing
1+
name: Unit Tests
22
on:
33
push:
44
branches: [ "master" ]

Documentation/examples.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,21 @@ the ``animate_spectrum()`` function. This will show the changes in the spectrum
154154
.. figure:: figs/spectrum-animated.gif
155155

156156
Output Spectrum
157+
158+
Converting to CSV
159+
=================
160+
161+
Sometimes, you just want to extract the data from the file so it can be processed by another program. Unfortunately, the
162+
library provides no way of doing that natively, however, it is fairly easy to do yourself:
163+
164+
.. code-block:: python
165+
166+
from shr_parser import ShrFileParser
167+
import numpy as np
168+
import csv
169+
with ShrFileParser('foo.shr') as parser:
170+
sweeps = parser.get_all_sweeps()
171+
sweeps = [sweep.sweep for sweep in sweeps]
172+
with open('output.csv', 'w') as f:
173+
writer = csv.writer(f)
174+
writer.writerows(np.vstack(sweeps).tolist())

README.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
===========================
2-
py-shr-parser
3-
===========================
1+
==============================
2+
py-shr-parser |Unit Testing|
3+
==============================
44

55
Overview
66
--------
@@ -37,3 +37,7 @@ This shows how to open an SHR file and load all the sweep data.
3737
sweeps = parser.get_all_sweeps()
3838
3939
The above example is very basic. For more advanced examples, please refer to the Documentation.
40+
41+
.. |Unit Testing| image:: https://github.com/WiseLabCMU/py-shr-parser/actions/workflows/unittest.yml/badge.svg
42+
:target: https://github.com/WiseLabCMU/py-shr-parser/actions/workflows/unittest.yml
43+
:alt: Test Status

0 commit comments

Comments
 (0)