Skip to content

Commit 2f5556f

Browse files
committed
doc(finder): Update the worked example
Even without using `tabulate`, it had fallen behind what actually happened.
1 parent 06dc809 commit 2f5556f

File tree

1 file changed

+32
-35
lines changed

1 file changed

+32
-35
lines changed

ch_util/finder.py

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,22 @@ class Finder:
147147
>>> f.only_corr()
148148
>>> f.set_time_range(datetime(2014,2,24), datetime(2014,2,25))
149149
>>> f.print_results_summary()
150-
interval | acquisition | offset from start (s) | length (s) | N files
151-
1 | 20140219T145849Z_abbot_corr | 378053.1 | 86400.0 | 25
152-
2 | 20140224T051212Z_stone_corr | 0.0 | 67653.9 | 19
153-
Total 154053.858720 seconds of data.
150+
# acquisition start (s) len (s) files MB
151+
--- --------------------------- ----------- --------- ------- -------
152+
0 20140219T145849Z_abbot_corr 378053 86400 25 3166.08
153+
1 20140224T051212Z_stone_corr 0 67653.9 19 2406.78
154+
Total 154054 seconds, 5573 MB of data.
154155
155156
Search for transits of a given source.
156157
157158
>>> import ch_ephem.sources
158159
>>> f.include_transits(ch_ephem.sources.CasA, time_delta=3600)
159160
>>> f.print_results_summary()
160-
interval | acquisition | offset from start (s) | length (s) | N files
161-
1 | 20140219T145849Z_abbot_corr | 452087.2 | 3600.0 | 2
162-
2 | 20140224T051212Z_stone_corr | 55288.0 | 3600.0 | 2
163-
Total 7200.000000 seconds of data.
161+
# acquisition start (s) len (s) files MB
162+
--- --------------------------- ----------- --------- ------- -------
163+
0 20140219T145849Z_abbot_corr 452092 3600 2 253.286
164+
1 20140224T051212Z_stone_corr 55292.9 3600 2 253.346
165+
Total 7200 seconds, 507 MB of data.
164166
165167
To read the data,
166168
@@ -184,50 +186,45 @@ class Finder:
184186
... & (di.CorrAcqInfo.nprod == 36)
185187
... & (di.ArchiveInst.name == 'stone'))
186188
>>> f.print_results_summary()
187-
interval | acquisition | offset from start (s) | length (s) | N files
188-
1 | 20140211T020307Z_stone_corr | 0.0 | 391.8 | 108
189-
2 | 20140128T135105Z_stone_corr | 0.0 | 4165.2 | 104
190-
3 | 20131208T070336Z_stone_corr | 0.0 | 1429.8 | 377
191-
4 | 20140212T014603Z_stone_corr | 0.0 | 2424.4 | 660
192-
5 | 20131210T060233Z_stone_corr | 0.0 | 1875.3 | 511
193-
6 | 20140210T021023Z_stone_corr | 0.0 | 874.1 | 240
194-
Total 11160.663510 seconds of data.
189+
# acquisition start (s) len (s) files MB
190+
--- --------------------------- ----------- --------- ------- --------
191+
0 20140211T020307Z_stone_corr 0 391.764 108 13594.1
192+
1 20140128T135105Z_stone_corr 0 4165.22 104 131711
193+
2 20131208T070336Z_stone_corr 0 1429.78 377 47676.4
194+
3 20140212T014603Z_stone_corr 0 2424.43 660 83604.1
195+
4 20131210T060233Z_stone_corr 0 1875.32 511 64704.8
196+
5 20140210T021023Z_stone_corr 0 874.144 240 30286.4
197+
Total 11161 seconds, 371577 MB of data.
198+
195199
196200
Here is an example that uses node spoofing and also filters files within
197201
acquisitions to include only LNA housekeeping files:
198202
199-
>>> f = finder.Finder(node_spoof = {"gong" : "/mnt/gong/archive",
200-
"suzu" : "/mnt/suzu/hk_data"})
203+
>>> f = finder.Finder(node_spoof={"scinet_hpss": "/dev/null"})
201204
>>> f.only_hk()
202205
>>> f.set_time_range(datetime(2014, 9, 1), datetime(2014, 10, 10))
203206
>>> f.print_results_summary()
204-
# | acquisition |start (s)| len (s) |files | MB
205-
0 | 20140830T005410Z_ben_hk | 169549 | 419873 | 47 | 2093
206-
1 | 20140905T203905Z_ben_hk | 0 | 16969 | 2 | 0
207-
2 | 20140908T153116Z_ben_hk | 0 | 1116260 | 56 | 4
208-
3 | 20141009T222415Z_ben_hk | 0 | 5745 | 2 | 0
207+
# acquisition start (s) len (s) files MB
208+
--- ----------------------- ----------- ---------------- ------- ------------
209+
0 20140830T005410Z_ben_hk 169549 419873 47 2093
210+
1 20140905T203905Z_ben_hk 0 16969.1 2 0.0832596
211+
2 20140908T153116Z_ben_hk 0 1.11626e+06 56 4.45599
212+
3 20141009T222415Z_ben_hk 0 5744.8 2 0.191574
213+
Total 1558847 seconds, 2098 MB of data.
209214
>>> res = f.get_results(file_condition = (di.HKFileInfo.atmel_name == "LNA"))
210215
>>> for r in res:
211-
... print("No. files: %d" % (len(r[0]))
216+
... print(f"No. files: {len(r[0])}")
217+
...
212218
No. files: 8
213219
No. files: 1
214220
No. files: 19
215221
No. files: 1
216-
>>> data = res[0].as_loaded_data()
217-
>>> for m in data.mux:
218-
... print("Mux %d: %s", (m, data.chan(m)))
219-
Mux 0: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
220-
Mux 1: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
221-
Mux 2: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
222-
>>> print(data.tod(14, 1))
223-
[1744.190917, 1766.344726, 1771.033569, ..., 1928.612792, 1938.900756, 1945.534912]
224222
225223
In the above example, the restriction to LNA housekeeping could also have
226224
been accomplished with the convenience method :meth:`Finder.set_hk_input`:
227225
228226
>>> f.set_hk_input("LNA")
229227
>>> res = f.get_results()
230-
231228
"""
232229

233230
# Constructors and setup
@@ -1368,8 +1365,8 @@ def print_results_summary(self):
13681365
total_data += length
13691366
total_size += s
13701367
interval_number += 1
1371-
tabulate.tabulate(rows, headers=titles)
1372-
print(f"Total {total_data:6.f} seconds, {total_size:6.f} MB of data.")
1368+
print(tabulate.tabulate(rows, headers=titles))
1369+
print(f"Total {total_data:6.0f} seconds, {total_size:6.0f} MB of data.")
13731370

13741371

13751372
def _trim_intervals_range(intervals, time_range, min_interval=0.0):

0 commit comments

Comments
 (0)