Created
May 7, 2014 06:06
-
-
Save kinverarity1/7cf065ef017fc15039a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import matplotlib.pyplot as plt | |
import bhlogging | |
inch2mm = lambda x: x * 25.4 | |
mm2inch = lambda x: x / 25.4 | |
fig_size = (8, 10) | |
fig = plt.figure(figsize=fig_size) | |
track_default = { | |
'convert_to_frac': lambda x: x / 100., | |
'grid': None | |
} | |
tracks = { | |
1: {'sides': (0, 25), | |
'type': 'graph', | |
'scales': [{'name': 'gamma', | |
'range': (0, 200), | |
'label': 'GAMMA'}, | |
{'name': 'caliper', | |
'range': (50, 350), | |
'label': 'CALIPER'}]}, | |
0: {'sides': (25, 33), | |
'type': 'text', | |
'interval': 5., | |
'fmt': '%.0f'}, | |
2: {'sides': (33, 66), | |
'type': 'graph', | |
'scales': [{'name': 'density', | |
'range': (10000, 0), | |
'label': 'DENSITY'}]}, | |
3: {'sides': (66, 100), | |
'type': 'graph', | |
'scales': [{'name': 'temperature', | |
'range': (0, 100), | |
'label': 'TEMP'}]}, | |
4: {'sides': (33, 100), | |
'type': 'graph', | |
'scales': [{'name': 'neutron', | |
'range': (0, 500), | |
'label': 'NEUTRON'}]} | |
} | |
tracks_proc = {} | |
for key, track in tracks.items(): | |
track_d = dict(track_default) | |
track_d.update(track) | |
tracks_proc[key] = track_d | |
log = bhlogging.read(r'') | |
for curve in log.curves: | |
print(curve.name, end=', ') | |
print('') | |
curve_track = { | |
'CALI': 1, | |
'GAPI': 1, | |
'DEPT': 0, | |
'DBFA[1]': 2, | |
'DBFA[2]': 2, | |
'DBNE[1]': 2, | |
'DBNE[2]': 2, | |
'T_DE': 3, | |
'NEUT': 4, | |
} | |
depth_curve_name = 'DEPT' | |
depth = log[depth_curve_name] | |
print('Depth.shape = %s' % (depth.shape)) | |
track_ax_kws = {'alpha': 0.0, | |
'frameon': False, | |
} | |
for tr_key, tr in tracks_proc.items(): | |
left, right = tr['sides'] | |
left = tr['convert_to_frac'](left) | |
right = tr['convert_to_frac'](right) | |
ax = fig.add_axes([left, 0.1, right - left, 0.8], **track_ax_kws) | |
print('Created Axes for track %s' % tr_key) | |
for curve, c_tr in curve_track.items(): | |
if c_tr == tr_key: | |
curve_data = log.get_curve_name(curve).data | |
print(' Plotting %s' % (curve)) | |
ax.plot(curve_data, depth, color='k') | |
if tr_key == 3: | |
ax.set_xlim(0, 100) | |
ax.set_ylim(*ax.get_ylim()[::-1]) | |
ax.set_ylim(600, 500) | |
plt.show() | |
''' | |
Each track is a vertical space on the figure. | |
Each track has multiple scales associated with it. | |
Each curve is assigned to a specific scale. | |
A scale can have multiple curves. | |
Each scale requires a horizontal space at the top of the figure. | |
These should be assigned per track, with the first at the lowest. | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment