Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing
name: Unit Tests
on:
push:
branches: [ "master" ]
Expand Down
18 changes: 18 additions & 0 deletions Documentation/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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())
10 changes: 7 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
===========================
py-shr-parser
===========================
==============================
py-shr-parser |Unit Testing|
==============================

Overview
--------
Expand Down Expand Up @@ -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