Skip to content

Commit 5f2ff81

Browse files
committed
- added in export_fig codes from file exchange
for easy figure export - added exportfig directory to optional installer - major update to sph_tri_* codes (output format now works better with delaunay codes and higher order polygon codes) - dropped sph_tri_latlon & sph_tri_vertices as these are trivial with new output format - fixed decay constant error bounds in slowdecay* - minor aesthetic changes to plot_cmb_measurements & cmb_pdf_mtx output - name2rgb now includes over 700 color names! - wedge introduced (like polar but better) - plotfkmap & plotfkarf now use wedge - better zoom support & simpler to use - mantledv now outputs wavetype of model too - mantlemap cleanup - mantleprofile introduced (uses new wedge function) - minor doc updates elsewhere
1 parent 58e2caf commit 5f2ff81

39 files changed

+4157
-692
lines changed

Diff for: Contents.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
% SEIZMO - Passive Seismology Toolbox
2-
% Version 0.6.189 Haleakala 17-Feb-2011
2+
% Version 0.6.190 Haleakala 25-Feb-2011
33
%
44
% Help Info
55
% <a href="matlab:help install_seizmo">INSTALLATION</a>

Diff for: alphabetical_list.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@
285285
%<a href="matlab:help mancor">mancor</a> - Returns mantle travel time corrections for a set of raypaths
286286
%<a href="matlab:help mantledv">mantledv</a> - Returns the seismic velocity deviation for a mantle model
287287
%<a href="matlab:help mantlemap">mantlemap</a> - 3D mantle model map (aka depth slice)
288+
%<a href="matlab:help mantleprofile">mantleprofile</a> - 3D mantle model profile (aka radial slice)
288289
%<a href="matlab:help map_cmb_profiles">map_cmb_profiles</a> - Map CMB profile measurements
289290
%<a href="matlab:help mapeventgrid">mapeventgrid</a> - Draws range/azimuth grid (relative to an event) on a map
290291
%<a href="matlab:help mapfeature">mapfeature</a> - Map geographic feature
@@ -457,9 +458,7 @@
457458
%<a href="matlab:help sph_poly_in">sph_poly_in</a> - Returns indexing for which polygon some points are in
458459
%<a href="matlab:help sph_tri_auto">sph_tri_auto</a> - Automatically create spherical triangle polyhedra
459460
%<a href="matlab:help sph_tri_init">sph_tri_init</a> - Returns vertices for regular spherical triangle polyhedra
460-
%<a href="matlab:help sph_tri_latlon">sph_tri_latlon</a> - Convert spherical triangle xyz arrays to lat/lon
461461
%<a href="matlab:help sph_tri_split">sph_tri_split</a> - Splits up faces of spherical triangle polyhedra
462-
%<a href="matlab:help sph_tri_vertices">sph_tri_vertices</a> - Unique vertices of a spherical triangle polyhedra
463462
%<a href="matlab:help sphericalfwd">sphericalfwd</a> - Finds a point on a sphere relative to another point
464463
%<a href="matlab:help sphericalinv">sphericalinv</a> - Return distance and azimuth between 2 locations on sphere
465464
%<a href="matlab:help split">split</a> - Lightblue-Blue-Black-Red-Lightred colormap
@@ -542,6 +541,7 @@
542541
%<a href="matlab:help vertcmp">vertcmp</a> - Finds vertical component SEIZMO records
543542
%<a href="matlab:help vincentyfwd">vincentyfwd</a> - Find destination point on an ellipsoid relative to a point
544543
%<a href="matlab:help vincentyinv">vincentyinv</a> - Find distance and azimuth between 2 locations on ellipsoid
544+
%<a href="matlab:help wedge">wedge</a> - Polar coordinate wedge plot
545545
%<a href="matlab:help whiten">whiten</a> - Spectral whitening/normalization of SEIZMO data records
546546
%<a href="matlab:help wlinem">wlinem</a> - Linear fit to traveltime data with weighted least squares
547547
%<a href="matlab:help write_1dmodel_nd">write_1dmodel_nd</a> - Writes a 1D model struct in .nd format

Diff for: cmb/cmb_pdf_mtx.m

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@
5959
% Feb. 1, 2011 - initial version
6060
% Feb. 10, 2011 - reduced plot code redundancy, use period not freq,
6161
% improved probability estimation, works with 1 pf
62+
% Feb. 17, 2011 - aesthetic touches
6263
%
6364
% Written by Garrett Euler (ggeuler at wustl dot edu)
64-
% Last Updated Feb. 10, 2011 at 13:35 GMT
65+
% Last Updated Feb. 17, 2011 at 13:35 GMT
6566

6667
% todo:
6768

@@ -156,10 +157,12 @@
156157
imagesc(p,x,mtx','parent',ax);
157158
colormap(ax,fire);
158159
set(ax,'ydir','normal','color','k','xcolor','w','ycolor','w');
160+
set(ax,'xminortick','on','yminortick','on');
161+
set(ax,'xgrid','on','ygrid','on','linewidth',1);
159162
xlabel(ax,'Period (s)');
160163
cb=colorbar('peer',ax);
161164
ylabel(cb,'% Probability');
162-
grid(ax,'on');
165+
set(cb,'linewidth',1);
163166
switch field
164167
case 'slow'
165168
ylabel(ax,'Ray Parameter (s/^o)');

Diff for: cmb/plot_cmb_measurements.m

+11-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
% Feb. 1, 2011 - initial version
3434
% Feb. 10, 2011 - reusing axes works, better labeling, doc update
3535
% Feb. 12, 2011 - altered line style code
36+
% Feb. 17, 2011 - aesthetic touches
3637
%
3738
% Written by Garrett Euler (ggeuler at wustl dot edu)
38-
% Last Updated Feb. 12, 2011 at 13:35 GMT
39+
% Last Updated Feb. 17, 2011 at 13:35 GMT
3940

4041
% todo:
4142

@@ -78,7 +79,7 @@
7879
ax=axescheck(varargin{:});
7980
if(isempty(ax))
8081
% new plot
81-
fh=figure();
82+
fh=figure('color','w');
8283
ax=axes('parent',fh);
8384
oldpts=0;
8485
else
@@ -102,7 +103,8 @@
102103

103104
% plot measurements
104105
[h(i),hyerr(i),hxerr(i)]=ploterr(ax,p0(a),x0(a),{lp(a) up(a)},e0(a),...
105-
[l m],'color',c,'markerfacecolor',mc,'markersize',10,varargin{:});
106+
[l m],'color',c,'markerfacecolor',mc,'markersize',6,...
107+
'linewidth',1,varargin{:});
106108
end
107109

108110
% change names if corrected
@@ -151,7 +153,12 @@
151153
% legend (regrab points objects to get those from previous plotting)
152154
drawnow; % legends can have issues if plot not drawn yet
153155
lh=legend(findobj(ax,'tag','points'));
154-
set(lh,'interpreter','none');
156+
set(lh,'interpreter','none','linewidth',1);
157+
158+
% polish
159+
box(ax,'on');
160+
set(ax,'xminortick','on','yminortick','on');
161+
set(ax,'xgrid','on','ygrid','on','linewidth',1);
155162

156163
% reset hold state
157164
if(~held); hold(ax,'off'); end

Diff for: cmb/slowdecaypairs.m

+8-7
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@
8585
% Jan. 31, 2011 - allow no output, odir input, better checks
8686
% Feb. 5, 2011 - fix bug when no output specified
8787
% Feb. 12, 2011 - include snr-based arrival time error
88+
% Feb. 17, 2011 - fixed decay constant error
8889
%
8990
% Written by Garrett Euler (ggeuler at wustl dot edu)
90-
% Last Updated Feb. 12, 2011 at 13:35 GMT
91+
% Last Updated Feb. 17, 2011 at 13:35 GMT
9192

9293
% todo:
9394

@@ -263,16 +264,16 @@
263264
tmp(b).cslowerr=sqrt(covm(2,2));
264265
[m,covm]=wlinem(delaz([idx1(b) idx2(b)],1),...
265266
log(rampl([idx1(b) idx2(b)])),1,...
266-
diag(log(rampl([idx1(b) idx2(b)])...
267-
+ramplerr([idx1(b) idx2(b)]).^2)....
268-
-log(rampl([idx1(b) idx2(b)]))));
267+
diag((log(rampl([idx1(b) idx2(b)])...
268+
+ramplerr([idx1(b) idx2(b)]))....
269+
-log(rampl([idx1(b) idx2(b)]))).^2));
269270
tmp(b).decay=m(2);
270271
tmp(b).decayerr=sqrt(covm(2,2));
271272
[m,covm]=wlinem(delaz([idx1(b) idx2(b)],1),...
272273
log(crampl([idx1(b) idx2(b)])),1,...
273-
diag(log(crampl([idx1(b) idx2(b)])...
274-
+ramplerr([idx1(b) idx2(b)]).^2)...
275-
-log(crampl([idx1(b) idx2(b)]))));
274+
diag((log(crampl([idx1(b) idx2(b)])...
275+
+ramplerr([idx1(b) idx2(b)]))...
276+
-log(crampl([idx1(b) idx2(b)]))).^2));
276277
tmp(b).cdecay=m(2);
277278
tmp(b).cdecayerr=sqrt(covm(2,2));
278279

Diff for: cmb/slowdecayprofiles.m

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@
8888
% Jan. 31, 2011 - allow no output, odir input, better checks
8989
% Feb. 5, 2011 - fix bug when no output specified
9090
% Feb. 12, 2011 - include snr-based arrival time error
91+
% Feb. 17, 2011 - fixed decay constant error
9192
%
9293
% Written by Garrett Euler (ggeuler at wustl dot edu)
93-
% Last Updated Feb. 12, 2011 at 13:35 GMT
94+
% Last Updated Feb. 17, 2011 at 13:35 GMT
9495

9596
% todo:
9697

@@ -252,11 +253,11 @@
252253
tmp(cnt).cslow=m(2);
253254
tmp(cnt).cslowerr=sqrt(covm(2,2));
254255
[m,covm]=wlinem(delaz(idx,1),log(rampl(idx)),1,...
255-
diag(log(rampl(idx)+ramplerr(idx).^2)-log(rampl(idx))));
256+
diag((log(rampl(idx)+ramplerr(idx))-log(rampl(idx))).^2));
256257
tmp(cnt).decay=m(2);
257258
tmp(cnt).decayerr=sqrt(covm(2,2));
258259
[m,covm]=wlinem(delaz(idx,1),log(crampl(idx)),1,...
259-
diag(log(crampl(idx)+ramplerr(idx).^2)-log(crampl(idx))));
260+
diag((log(crampl(idx)+ramplerr(idx))-log(crampl(idx))).^2));
260261
tmp(cnt).cdecay=m(2);
261262
tmp(cnt).cdecayerr=sqrt(covm(2,2));
262263
end

Diff for: docs/seizmo_to_do.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ make noise processing more flexible (file length & overlap)
2929

3030
cmt subtoolbox
3131
- main thing is to plot CMTS!!!
32-
plotting profiles for models
33-
- need a decent polar plotting program to plot slices of the pie
34-
with inner & outer radii specified. Not even mmpolar does it.
35-
- need to add raypath plotting support too
3632

3733
more cmb models (rjk)
3834
- we need to allow parameter setting (while loop rather than for)
3935
- cell of numbers {depths/heights velo%s}
4036
- inputs will change per model or series ...
4137
- can never really do everything here ... just go for basics
4238
expand sph tri stuff
43-
- use delaunay codes
4439
- function to make g matrix for sph tri stuff
40+
- distance from polygon center to pnts on line
41+
- simple logical for flat weighting
42+
- distance based gaussian weighting
43+
- inversion is % from prem?
44+
- have to do synthetics for all events
4545

4646

4747
%%%%%%%

Diff for: exportfig/.ignore/ghostscript.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gs

Diff for: exportfig/eps2pdf.m

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
%EPS2PDF Convert an eps file to pdf format using ghostscript
2+
%
3+
% Examples:
4+
% eps2pdf source dest
5+
% eps2pdf(source, dest, crop)
6+
% eps2pdf(source, dest, crop, append)
7+
% eps2pdf(source, dest, crop, append, gray)
8+
% eps2pdf(source, dest, crop, append, gray, quality)
9+
%
10+
% This function converts an eps file to pdf format. The output can be
11+
% optionally cropped and also converted to grayscale. If the output pdf
12+
% file already exists then the eps file can optionally be appended as a new
13+
% page on the end of the eps file. The level of bitmap compression can also
14+
% optionally be set.
15+
%
16+
% This function requires that you have ghostscript installed on your
17+
% system. Ghostscript can be downloaded from: http://www.ghostscript.com
18+
%
19+
%IN:
20+
% source - filename of the source eps file to convert. The filename is
21+
% assumed to already have the extension ".eps".
22+
% dest - filename of the destination pdf file. The filename is assumed to
23+
% already have the extension ".pdf".
24+
% crop - boolean indicating whether to crop the borders off the pdf.
25+
% Default: true.
26+
% append - boolean indicating whether the eps should be appended to the
27+
% end of the pdf as a new page (if the pdf exists already).
28+
% Default: false.
29+
% gray - boolean indicating whether the output pdf should be grayscale or
30+
% not. Default: false.
31+
% quality - scalar indicating the level of image bitmap quality to
32+
% output. A larger value gives a higher quality. quality > 100
33+
% gives lossless output. Default: ghostscript prepress default.
34+
35+
% Copyright (C) Oliver Woodford 2009-2010
36+
37+
% Suggestion of appending pdf files provided by Matt C at:
38+
% http://www.mathworks.com/matlabcentral/fileexchange/23629
39+
40+
% Thank you to Fabio Viola for pointing out compression artifacts, leading
41+
% to the quality setting.
42+
% Thank you to Scott for pointing out the subsampling of very small images,
43+
% which was fixed for lossless compression settings.
44+
45+
function eps2pdf(source, dest, crop, append, gray, quality)
46+
% Intialise the options string for ghostscript
47+
options = ['-q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile="' dest '"'];
48+
% Set crop option
49+
if nargin < 3 || crop
50+
options = [options ' -dEPSCrop'];
51+
end
52+
% Set the grayscale option
53+
if nargin > 4 && gray
54+
options = [options ' -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray'];
55+
end
56+
% Set the bitmap quality
57+
if nargin > 5 && ~isempty(quality)
58+
options = [options ' -dAutoFilterColorImages=false -dAutoFilterGrayImages=false'];
59+
if quality > 100
60+
options = [options ' -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -c ".setpdfwrite << /ColorImageDownsampleThreshold 10 /GrayImageDownsampleThreshold 10 >> setdistillerparams"'];
61+
else
62+
options = [options ' -dColorImageFilter=/DCTEncode -dGrayImageFilter=/DCTEncode'];
63+
v = 1 + (quality < 80);
64+
quality = 1 - quality / 100;
65+
s = sprintf('<< /QFactor %.2f /Blend 1 /HSample [%d 1 1 %d] /VSample [%d 1 1 %d] >>', quality, v, v, v, v);
66+
options = sprintf('%s -c ".setpdfwrite << /ColorImageDict %s /GrayImageDict %s >> setdistillerparams"', options, s, s);
67+
end
68+
end
69+
% Check if the output file exists
70+
if nargin > 3 && append && exist(dest, 'file') == 2
71+
% File exists - append current figure to the end
72+
tmp_nam = tempname;
73+
% Copy the file
74+
copyfile(dest, tmp_nam);
75+
% Add the output file names
76+
options = [options ' -f "' tmp_nam '" "' source '"'];
77+
try
78+
% Convert to pdf using ghostscript
79+
[status message] = ghostscript(options);
80+
catch
81+
% Delete the intermediate file
82+
delete(tmp_nam);
83+
rethrow(lasterror);
84+
end
85+
% Delete the intermediate file
86+
delete(tmp_nam);
87+
else
88+
% File doesn't exist or should be over-written
89+
% Add the output file names
90+
options = [options ' -f "' source '"'];
91+
% Convert to pdf using ghostscript
92+
[status message] = ghostscript(options);
93+
end
94+
% Check for error
95+
if status
96+
% Report error
97+
if isempty(message)
98+
error('Unable to generate pdf. Check destination directory is writable.');
99+
else
100+
error(message);
101+
end
102+
end
103+
return
104+

0 commit comments

Comments
 (0)