Skip to content

Commit 9dca351

Browse files
committed
toward v014
1 parent 20a2355 commit 9dca351

File tree

5 files changed

+67
-28
lines changed

5 files changed

+67
-28
lines changed

Diff for: obstools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
110110
"""
111111

112-
__version__ = '0.1.3'
112+
__version__ = '0.1.4'
113113

114114
__author__ = 'Pascal Audet & Helen Janiszewski'
115115

Diff for: obstools/atacr/plotting.py

+51-20
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,41 @@ def fig_comply(f, day_comps, day_list, sta_comps, sta_list, skey=None,
436436
ax.yaxis.get_offset_text().set_fontsize(8)
437437

438438
if day_list[key]:
439+
compliance_list = []
440+
coherence_list = []
439441
for i in range(len(day_comps)):
440442
compliance = np.abs(day_comps[i][key][0])
443+
coherence = np.abs(day_comps[i][key][1])
444+
if not np.isnan(compliance).any():
445+
compliance_list.append(compliance)
446+
coherence_list.append(coherence)
447+
compliance_mean = np.mean(np.array(compliance_list), axis=0)
448+
compliance_std = np.std(np.array(compliance_list), axis=0)
449+
coherence_mean = np.mean(np.array(coherence_list), axis=0)
450+
coherence_std = np.std(np.array(coherence_list), axis=0)
451+
452+
ax.fill_between(
453+
f[faxis],
454+
compliance_mean[faxis]-compliance_std[faxis],
455+
compliance_mean[faxis]+compliance_std[faxis],
456+
fc='royalblue', alpha=0.3, label=r'$\pm$ Std daily'
457+
)
458+
ax.plot(
459+
f[faxis], compliance_mean[faxis], c='royalblue',
460+
lw=0.5, label='Mean daily')
461+
ax.set_xlim(f_0, f_c)
462+
ytop = 1.2*np.max(compliance_mean[(f > f_0) & (f < f_c)])
463+
ybot = 0/8*np.min(compliance_mean[(f > f_0) & (f < f_c)])
464+
ax.set_ylim(ybot, ytop)
465+
466+
if sta_list[key]:
467+
for i in range(len(sta_comps)):
468+
compliance = np.abs(sta_comps[i][key][0])
441469
ax.plot(
442470
f[faxis],
443471
compliance[faxis],
444-
'gray', alpha=0.3, lw=0.5)
445-
ax.set_xlim(f_0, f_c)
446-
ytop = np.max(compliance[(f > f_0) & (f < f_c)])
447-
ybot = np.min(compliance[(f > f_0) & (f < f_c)])
448-
ax.set_ylim(ybot, ytop)
449-
450-
if sta_list[key]:
451-
ax.plot(
452-
f[faxis],
453-
np.abs(sta_comps[key][0][faxis]),
454-
'k', lw=0.5)
472+
'red', lw=0.5, alpha=0.5,
473+
label='Sta average')
455474

456475
if key == 'ZP':
457476
ax.set_title(skey+' Compliance: ZP',
@@ -467,20 +486,32 @@ def fig_comply(f, day_comps, day_list, sta_comps, sta_list, skey=None,
467486
ax.axvline(f_0, ls='--', c='k', lw=0.75)
468487
ax.axvline(f_c, ls='--', c='k', lw=0.75)
469488

489+
handles, labels = ax.get_legend_handles_labels()
490+
by_label = dict(zip(labels, handles))
491+
ax.legend(by_label.values(), by_label.keys(), fontsize=6)
492+
470493
ax = fig.add_subplot(ncomps, 2, j*2+2)
471494
ax.tick_params(labelsize=8)
472495

473496
if day_list[key]:
474-
for i in range(len(day_comps)):
475-
ax.semilogx(
476-
f[faxis],
477-
np.abs(day_comps[i][key][1][faxis]),
478-
'gray', alpha=0.3, lw=0.5)
497+
# for i in range(len(day_comps)):
498+
ax.fill_between(
499+
f[faxis],
500+
coherence_mean[faxis]-coherence_std[faxis],
501+
coherence_mean[faxis]+coherence_std[faxis],
502+
fc='royalblue', alpha=0.3
503+
)
504+
ax.plot(
505+
f[faxis],
506+
coherence_mean[faxis],
507+
c='royalblue', lw=0.75)
479508
if sta_list[key]:
480-
ax.semilogx(
481-
f[faxis],
482-
np.abs(sta_comps[key][1][faxis]),
483-
'k', lw=0.5)
509+
for i in range(len(sta_comps)):
510+
ax.plot(
511+
f[faxis],
512+
np.abs(sta_comps[i][key][1][faxis]),
513+
'red', lw=0.5, alpha=0.5)
514+
ax.set_xscale('log')
484515

485516
if key == 'ZP':
486517
ax.set_title(skey+' Coherence: ZP',

Diff for: obstools/scripts/atacr_transfer_functions.py

+8
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ def main(args=None):
361361
# Save daily transfer functions to file
362362
daytransfer.save(filename)
363363

364+
# Create empty daynoise if not loaded
365+
# else:
366+
# XXX
367+
364368
if not args.skip_clean:
365369

366370
# Cycle through available files
@@ -395,6 +399,10 @@ def main(args=None):
395399
# Save average transfer functions to file
396400
statransfer.save(filename)
397401

402+
# Create empty stanoise if not loaded
403+
# else:
404+
# XXX
405+
398406
if args.fig_TF:
399407
fname = stkey + '.' + 'transfer_functions'
400408
plot = plotting.fig_TF(

Diff for: obstools/scripts/comply_calculate.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ def main(args=None):
395395

396396
if not args.skip_clean:
397397

398+
sta_comply_functions = []
399+
398400
# Cycle through available files
399401
for fileavst in average_files:
400402

@@ -411,7 +413,7 @@ def main(args=None):
411413
# Load Comply object and append to list
412414
stacomply = pickle.load(open(filepkl, 'rb'))
413415
f = stacomply.f
414-
sta_comply_functions = stacomply.complyfunc
416+
sta_comply_functions.append(stacomply.complyfunc)
415417
continue
416418

417419
print("\n"+"*"*60)
@@ -434,7 +436,7 @@ def main(args=None):
434436
f = stacomply.f
435437

436438
# Extract the transfer functions - for plotting
437-
sta_comply_functions = stacomply.complyfunc
439+
sta_comply_functions.append(stacomply.complyfunc)
438440

439441
# Save average transfer functions to file
440442
stacomply.save(filename, form=args.saveformat)

Diff for: setup.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os.path
33
from os import listdir
44
import re
5-
from numpy.distutils.core import setup
5+
from setuptools import setup
66
from pathlib import Path
77

88

@@ -26,17 +26,15 @@ def find_version(*paths):
2626
author_email='[email protected]',
2727
maintainer='Pascal Audet, Helen Janiszewski',
2828
29-
url='https://github.com/nfsi-canada/OBStools/archive/OBStools-0.1.3.tar.gz',
29+
url='https://github.com/nfsi-canada/OBStools/archive/OBStools-0.1.4.tar.gz',
3030
classifiers=[
3131
'Development Status :: 3 - Alpha',
3232
'License :: OSI Approved :: MIT License',
3333
'Programming Language :: Python :: 3.6',
3434
'Programming Language :: Python :: 3.7',
3535
'Programming Language :: Python :: 3.8',
3636
'Programming Language :: Python :: 3.9'],
37-
install_requires=[
38-
'numpy<=1.21.5', 'scipy<=1.8.0',
39-
'obspy<=1.2.2', 'stdb==0.2.3', 'pandas<=1.4.1'],
37+
install_requires=['numpy', 'obspy', 'stdb', 'scipy', 'pandas'],
4038
python_requires='>=3.6',
4139
packages=setuptools.find_packages(),
4240
include_package_data=True,

0 commit comments

Comments
 (0)