File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : Testing
1+ name : Unit Tests
22on :
33 push :
44 branches : [ "master" ]
Original file line number Diff line number Diff 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())
Original file line number Diff line number Diff line change 1- ===========================
2- py-shr-parser
3- ===========================
1+ ==============================
2+ py-shr-parser | Unit Testing |
3+ ==============================
44
55Overview
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
You can’t perform that action at this time.
0 commit comments