Commit e65cb314 authored by Jennifer Rinker's avatar Jennifer Rinker

minor doc changes

parent ad85be20
Pipeline #3488 failed with stage
......@@ -4,12 +4,12 @@ Notes
-----
1. This submodule is a work in progress. We will need to determine how best to
organize everything.
2. rink used Pyhon 3.6 string formatting because I love it.
2. rink used Python 3.6 string formatting because I love it.
Current Status/To-Do
--------------------
2017.10.13 - functions related to loading HAWC2 binary files added. next steps
are to
are to...
(1) port David's unique channel names (w/modifications),
(2) write tests, and
(3) write documentation.
......@@ -103,20 +103,21 @@ def get_num_scans(path):
def dat_to_df(path, n_scns=None, channel_names=None, sel_df=None):
"""HAWC2 binary .dat file to pandas dataframe
"""
# load necessary info if not passed in
if n_scns is None: # get number of scans if not passed in
n_scns = n_scns = get_num_scans(path)
if channel_names is None: # get channel names if not passed in
channel_names = get_unique_chnl_names(path)
if sel_df is None: # get .sel dataframe if not passed in
sel_df = sel_to_df(path)
# load data in dat file
dat_path = os.path.splitext(path)[0] + '.dat' # path to dat file
with open(dat_path, 'rb') as dat_fid:
dat_df = pd.DataFrame(np.zeros((n_scns, len(channel_names))),
columns=channel_names)
j = 0
for i in range(sel_df.shape[0]):
dat_fid.seek(i * n_scns * 2, 0)
dat_df.iloc[:, j] = np.fromfile(dat_fid, 'int16', n_scns) * \
dat_df.iloc[:, i] = np.fromfile(dat_fid, 'int16', n_scns) * \
sel_df.loc[i, 'scale']
j += 1
return dat_df
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment