-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_time_investigate.py
More file actions
49 lines (41 loc) · 1.37 KB
/
Copy pathread_time_investigate.py
File metadata and controls
49 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import time
import numpy as np
from hdf_read import Hdf5Spectra
from astropy.table import Table
in_dir = '/shared/ebla/cotar/'
s_ids = np.array(Table.read(in_dir+'sobject_iraf_53_reduced_20180327.fits')['sobject_id'])
hdf_gzip = Hdf5Spectra('galah_dr53_gzip_full.hdf5', raw=True)
hdf_lzf = Hdf5Spectra('galah_dr53_lzf_full.hdf5', raw=True)
hdf_none = Hdf5Spectra('galah_dr53_none_full.hdf5', raw=True)
# get merged data for the first 50 stars
spectra_in_file = s_ids[:80]
N_rep = 250
# ccds = list([1])
ccds = list([1, 2, 3, 4])
# ranges = list([[4700, 4710], [5800, 5810], [6650, 6660], [7700, 7710]]) # a bit faster, but not much
ranges = None
# GZIP
t_s = time.time()
for i in range(N_rep):
temp = hdf_gzip.get_h5_data(spectra_in_file, ccds=ccds, wvl_ranges=ranges)
t_e = time.time()
dt = t_e - t_s
print 'GZIP - time: {:.4f}s, avg: {:.4f}s'.format(dt, dt/N_rep)
# LZF
t_s = time.time()
for i in range(N_rep):
temp = hdf_lzf.get_h5_data(spectra_in_file, ccds=ccds, wvl_ranges=ranges)
t_e = time.time()
dt = t_e - t_s
print 'LZF - time: {:.4f}s, avg: {:.4f}s'.format(dt, dt/N_rep)
# No compression
t_s = time.time()
for i in range(N_rep):
temp = hdf_none.get_h5_data(spectra_in_file, ccds=ccds, wvl_ranges=ranges)
t_e = time.time()
dt = t_e - t_s
print 'None - time: {:.4f}s, avg: {:.4f}s'.format(dt, dt/N_rep)
# close files
hdf_gzip.close()
hdf_lzf.close()
hdf_none.close()