Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jul 10, 2018
1 parent f84f716 commit 6954897
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
20 changes: 14 additions & 6 deletions RunSimulFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,32 @@
Updated Aug 2015 to handle HDF5 user-friendly huge video file format
uses data converted from raw .DMCdata format by a command like
./ConvertDMC2h5.py ~/U/irs_archive4/HSTdata/2013-04-14-HST1/2013-04-14T07-00-CamSer1387.DMCdata -s 2013-04-14T07:00:07Z -k 0.0333333333333333 -t 2013-04-14T9:25:00Z 2013-04-14T9:35:00Z -l 65.12657 -147.496908333 210 --rotccw 2 -o ~/data/2013-04-14/hst/2013-04-14T0925_hst1.h5
./ConvertDMC2h5.py ~//HSTdata/2013-04-14-HST1/2013-04-14T07-00-CamSer1387.DMCdata \
-s 2013-04-14T07:00:07Z -k 0.0333333333333333 -t 2013-04-14T9:25:00Z 2013-04-14T9:35:00Z \
-l 65.12657 -147.496908333 210 --rotccw 2 -o ~/data/2013-04-14/hst/2013-04-14T0925_hst1.h5
examples:
./RunSimulFrame.py ~/data/2007-03-23/optical/2007-03-23T1120_8bit.h5 --cmin 0 --cmax 255
./RunSimulFrame.py ~/data/2007-03-23/optical/2007-03-23T1120.h5 --cmin 1500 --cmax 16384
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T8-54_hst0.h5 ~/data/2013-04-14/HST/2013-04-14T8-54_hst1.h5 -t 2013-04-14T08:54:25Z 2013-04-14T08:54:30Z
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T8-54_hst0.h5 \
~/data/2013-04-14/HST/2013-04-14T8-54_hst1.h5 -t 2013-04-14T08:54:25Z 2013-04-14T08:54:30Z
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T1034_hst1.h5 -c cal/hst1cal.h5 -s -0.1886792453 --cmin 1050 --cmax 1150 -m 77.5 19.9
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T1034_hst0.h5 ~/data/2013-04-14/hst/2013-04-14T1034_hst1.h5 -c cal/hst0cal.h5 cal/hst1cal.h5 -s -0.1886792453 0 --cmin 100 1025 --cmax 2000 1130 -m 77.5 19.9 -t 2013-04-14T10:34:25Z 2013-04-14T10:35:00Z
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T1034_hst1.h5 -c cal/hst1cal.h5 \
-s -0.1886792453 --cmin 1050 --cmax 1150 -m 77.5 19.9
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T1034_hst0.h5 ~/data/2013-04-14/hst/2013-04-14T1034_hst1.h5 \
-c cal/hst0cal.h5 cal/hst1cal.h5 -s -0.1886792453 0 --cmin 100 1025 --cmax 2000 1130 \
-m 77.5 19.9 -t 2013-04-14T10:34:25Z 2013-04-14T10:35:00Z
#apr14 925
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T0925_hst1.h5 -c cal/hst1cal.h5 --cmin 1090 --cmax 1140 -t 2013-04-14T09:27Z 2013-04-14T09:30Z
./RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T0925_hst1.h5 -c cal/hst1cal.h5 \
--cmin 1090 --cmax 1140 -t 2013-04-14T09:27Z 2013-04-14T09:30Z
RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T0925_hst1.h5 --cmin 1090 --cmax 1140 -f 0 17998 20 -s 0
#apr14 824
RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T0824_hst1.h5 --cmin 1090 --cmax 1350 -t 2013-04-14T08:25:45Z 2013-04-14T08:26:30Z
RunSimulFrame.py ~/data/2013-04-14/hst/2013-04-14T0824_hst1.h5 --cmin 1090 --cmax 1350 \
-t 2013-04-14T08:25:45Z 2013-04-14T08:26:30Z
"""
from dateutil.parser import parse
Expand Down
4 changes: 2 additions & 2 deletions histutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ def vid2h5(data: np.ndarray, ut1, rawind, ticks, outfn: Path, P: dict, i: int=0,
f['/rawimg'][ind, ...] = data

if ut1 is not None:
print(
f'writing from {datetime.utcfromtimestamp(ut1[0]).replace(tzinfo=UTC)} to {datetime.utcfromtimestamp(ut1[-1]).replace(tzinfo=UTC)}')
print(f'writing from {datetime.utcfromtimestamp(ut1[0]).replace(tzinfo=UTC)}'
'to {datetime.utcfromtimestamp(ut1[-1]).replace(tzinfo=UTC)}')
if 'ut1_unix' not in f:
fut1 = f.create_dataset(
'/ut1_unix', shape=(N,), dtype=float, fletcher32=True)
Expand Down
6 changes: 3 additions & 3 deletions histutils/camclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def __init__(self, sim, cp, name: str,
try:
if self.fovmaxlen < (1.5 * zmax):
logging.warning(
'sanityCheck: To avoid unexpected pixel/sky voxel intersection problems, make your candidate camera FOV at least 1.5 times longer than your maximum Z altitude.')
'sanityCheck: To avoid unexpected pixel/sky voxel intersection problems,'
' make your candidate camera FOV at least 1.5 times longer than your maximum Z altitude.')
except TypeError: # just plotting raw data
pass

Expand Down Expand Up @@ -190,9 +191,8 @@ def __init__(self, sim, cp, name: str,
elif self.fn.suffix == '.h5':

assert self.fn.is_file(), f'{self.fn} does not exist'

"""timing, parameter wrangling FIXME someday use xarray.Dataset. convert/save data with xarray instead of h5py"""
with h5py.File(self.fn, 'r') as f:
# %% timing, parameter wrangling FIXME someday do this with xarray.Dataset instead and convert/save data with xarray instead of h5py
# time of each frame in entire video
self.ut1unix = f['/ut1_unix'][:]
try:
Expand Down
3 changes: 2 additions & 1 deletion histutils/rawDMCreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ def whichframes(fn, FrameIndReq, kineticsec, ut1req, startUTC, firstRawInd, last
"""
if no requested frames were specified, read all frames. Otherwise, just
return the requested frames
note these assignments have to be "int64", not just python "int", because on windows python 2.7 64-bit on files >2.1GB, the bytes will wrap
Assignments have to be "int64", not just python "int".
Windows python 2.7 64-bit on files >2.1GB, the bytes will wrap
"""
FrameIndRel = ut12frame(ut1req,
arange(0, nFrame, 1, dtype=int64),
Expand Down

0 comments on commit 6954897

Please sign in to comment.