In [14]:
import utils
import utils as john

In [15]:
import main
import imp
imp.reload(main)
imp.reload(utils)
import numpy as np

In [16]:
bore_id = 'DD1097'
    top = 100
    bottom = 400
    window_size = bottom-top
    mid = (top+bottom)/2.0
    bin_size = 0.5

    df_data = john.get_windows(boreid = bore_id, centre_point = mid, window_size = window_size, bin_width = bin_size)

In [22]:
df_data = df_data.rename(columns={'index':'DEPTH'})

labels = df_data.DEPTH.apply(lambda x: john.get_label(bore_id, x))

In [24]:
labels


Out[24]:
0      NaN
1      NaN
2      NaN
3      NaN
4      NaN
5      NaN
6      NaN
7      NaN
8      NaN
9      NaN
10     NaN
11     NaN
12     NaN
13     NaN
14     NaN
15     NaN
16     NaN
17     NaN
18     NaN
19     NaN
20     NaN
21     NaN
22     NaN
23     NaN
24     NaN
25     NaN
26     NaN
27     NaN
28     NaN
29     NaN
      ... 
378    NaN
379    NaN
380    NaN
381    NaN
382    NaN
383    NaN
384    NaN
385    NaN
386    NaN
387    NaN
388    NaN
389    NaN
390    NaN
391     GC
392     GC
393     GC
394     GC
395     GC
396    NaN
397    NaN
398    NaN
399    NaN
400    NaN
401    NaN
402    NaN
403    NaN
404    NaN
405    NaN
406    NaN
407    NaN
Name: DEPTH, dtype: object

In [8]:
label = []

    print( len(df_data)) # gives 408

    for depth in np.arange(top, bottom+bin_size, bin_size):

        label.append(john.get_label(bore_id = bore_id, depth = depth))

    print( len(label)) # gives 601
    df_data['Label'] = label


    #df_data.to_csv('%s_cleandata.csv'%bore_id)


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-8-e06e9b7eb384> in <module>()
----> 1 main.extract_seams('DD1097')

/Users/jvial/Documents/source/2d3g/main.py in extract_seams(bore_id, seam_list)
    125     bin_size = 0.5
    126 
--> 127     df_data = john.get_windows(boreid = bore_id, centre_point = mid, window_size = window_size, bin_width = bin_size)
    128 
    129     label = []

/Users/jvial/Documents/source/2d3g/utils.py in get_windows(boreid, centre_point, window_size, bin_width)
    215 
    216     if atv_dictionary.get(boreid, None) is None:
--> 217         atv = pd.read_excel('Acoustic Scanner/ATV_Data_{}.xlsx'.format(boreid))
    218         atv_dictionary[boreid] = atv
    219     else:

/Users/jvial/anaconda/envs/py3k/lib/python3.3/site-packages/pandas/io/excel.py in read_excel(io, sheetname, **kwds)
    149     engine = kwds.pop('engine', None)
    150 
--> 151     return ExcelFile(io, engine=engine).parse(sheetname=sheetname, **kwds)
    152 
    153 

/Users/jvial/anaconda/envs/py3k/lib/python3.3/site-packages/pandas/io/excel.py in __init__(self, io, **kwds)
    186                 self.book = xlrd.open_workbook(file_contents=data)
    187             else:
--> 188                 self.book = xlrd.open_workbook(io)
    189         elif engine == 'xlrd' and isinstance(io, xlrd.Book):
    190             self.book = io

/Users/jvial/anaconda/envs/py3k/lib/python3.3/site-packages/xlrd/__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows)
    414                 formatting_info=formatting_info,
    415                 on_demand=on_demand,
--> 416                 ragged_rows=ragged_rows,
    417                 )
    418             return bk

/Users/jvial/anaconda/envs/py3k/lib/python3.3/site-packages/xlrd/xlsx.py in open_workbook_2007_xml(zf, component_names, logfile, verbosity, use_mmap, formatting_info, on_demand, ragged_rows)
    789         x12sheet = X12Sheet(sheet, logfile, verbosity)
    790         heading = "Sheet %r (sheetx=%d) from %r" % (sheet.name, sheetx, fname)
--> 791         x12sheet.process_stream(zflo, heading)
    792         del zflo
    793         comments_fname = 'xl/comments%d.xml' % (sheetx + 1)

/Users/jvial/anaconda/envs/py3k/lib/python3.3/site-packages/xlrd/xlsx.py in own_process_stream(self, stream, heading)
    524         row_tag = U_SSML12 + "row"
    525         self_do_row = self.do_row
--> 526         for event, elem in ET.iterparse(stream):
    527             if elem.tag == row_tag:
    528                 self_do_row(elem)

/Users/jvial/anaconda/envs/py3k/lib/python3.3/xml/etree/ElementTree.py in __next__(self)
   1786                 if data:
   1787                     try:
-> 1788                         self._parser.feed(data)
   1789                     except SyntaxError as exc:
   1790                         self._error = exc

KeyboardInterrupt: 

In [ ]: