diff --git a/+defaults/general_defaults.json b/+defaults/general_defaults.json index c06bebb2..74218643 100644 --- a/+defaults/general_defaults.json +++ b/+defaults/general_defaults.json @@ -1,8 +1,8 @@ { "Directories":{ - "output":"./output", - "data":"./eq_data", - "working":"./working" + "output":"../m_zmap_files/output", + "data":"../my_zmap_files/eq_data", + "working":"../my_zmap_files/zmap7/working" }, "ParallelProcessing":{ "Enable":false, diff --git a/README.md b/README.md index bf04d52d..3a8ed091 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Clicking on the `see distributions` button will show a few histograms that may h ### Main Map Screen Once a catalog is loaded, earthquakes will be plotted in the Main Window. -![MainMapScreen](resources/img/ZmapMainWindow_20180216.png) +![MainMapScreen](docs/img/ZmapMainWindow_20180216.png) This is where most of the work will happen. The screen is divided into several sections. When first presented, all events will be hilighted, and the main map will take up the entirety of the left side of the window. The plots on the right side of the screen will reflect statistics for the entire catalog. diff --git a/importfilters/import_fdsn_event.m b/importfilters/import_fdsn_event.m index bc23864b..f3243f26 100644 --- a/importfilters/import_fdsn_event.m +++ b/importfilters/import_fdsn_event.m @@ -139,12 +139,15 @@ ok=false; case "BadRequest" disp(resp.Body.Data) - + numbers= double(regexp(extractBefore(resp.Body.Data,'Request:'),'\d\d\d+','match')); + % first number is the error, so ignore it. + numbers(1)=[]; + % second number is % as of 2018-12-14, USGS returns this result when limit is exceeded. these depend on the error message wording - maxSearchLimit = double(extractBefore(extractAfter(resp.Body.Data,'exceeds search limit of '),'.')); - nFound = double(extractBefore(extractAfter(resp.Body.Data,'exceeds search limit of '),'.')); + maxSearchLimit = min(numbers); + nFound = max(numbers); if ~ismissing(maxSearchLimit) - warning("maximum number of events [%d] exceeded. atttempting to limit results", maxSearchLimit); + warning("maximum number of events [%d] exceeded. attempting to limit results", maxSearchLimit); % try again, in chunks of maxSearchLimit disp('* trying again while limiting results') [resp, ok] = get_in_chunks(myuri, maxSearchLimit, nFound); diff --git a/src/+XYfun/bvalgrid.m b/src/+XYfun/bvalgrid.m index 89ca925f..6109194d 100644 --- a/src/+XYfun/bvalgrid.m +++ b/src/+XYfun/bvalgrid.m @@ -34,7 +34,7 @@ 'Additional_Runs_b_std', 'Additional_Runs_Mc_std', 'failreason', 'nEvents_gt_local_Mc'} ParameterableProperties = ["NodeMinEventCount", "nBstSample", "useBootstrap", "fMccorr",... - "fBinning", "mc_choice", "mc_auto_est"]; + "fBinning", "mc_choice", "mc_auto_est"] References = ""; end diff --git a/src/+XZfun/bcross.m b/src/+XZfun/bcross.m index fafa5b21..4135e74d 100644 --- a/src/+XZfun/bcross.m +++ b/src/+XZfun/bcross.m @@ -3,7 +3,7 @@ properties nBstSample {mustBeNonnegative,mustBeInteger} = 100 % number of bootstrap samples useBootstrap logical = false % perform bootstrapping? - fMccorr double = 0.2 % magnitude correction + fMccorr double = 0.0 % magnitude correction fBinning {mustBePositive} = 0.1 % magnitude bins mc_choice McMethods = McMethods.MaxCurvature % magnitude of completion method mc_auto_est McAutoEstimate = McAutoEstimate.auto @@ -33,7 +33,7 @@ ParameterableProperties = ["NodeMinEventCount", "nBstSample", "useBootstrap", "fMccorr",... "fBinning", "mc_choice", "mc_auto_est"]; - References = ""; + References = "" end methods @@ -61,14 +61,9 @@ function InteractiveSetup(obj) zdlg.AddHeader('Choose stuff'); zdlg.AddMcMethodDropdown('mc_choice'); - % zdlg.AddGridSpacing('gridOpts', dx, 'km' , [], '' , dd, 'km'); - % obj.AddDialogOption(zdlg, 'EventSelector'); - zdlg.AddEdit('fBinning' , 'Magnitude binning' , obj.fBinning,... 'Bins for magnitudes'); obj.AddDialogOption(zdlg, 'NodeMinEventCount'); - %zdlg.AddEdit('fMcFix' , 'Fixed Mc' , fMcFix,... - % 'fixed magnitude of completeness (Mc)'); zdlg.AddEdit('fMccorr' , 'Mc correction factor' , obj.fMccorr,... 'Correction term to be added to Mc'); zdlg.AddCheckbox('useBootstrap' , 'Use Bootstrapping' , false, checkboxTargets,... @@ -145,7 +140,6 @@ function InteractiveSetup(obj) function ModifyGlobals(obj) obj.ZG.bvg = obj.Result.values; - obj.ZG.Grid = obj.Grid; %TODO do we really write back the grid? end end diff --git a/src/+XZfun/bcrossVt2.m b/src/+XZfun/bcrossVt2.m index e65ed26f..cbcb1fd8 100644 --- a/src/+XZfun/bcrossVt2.m +++ b/src/+XZfun/bcrossVt2.m @@ -11,11 +11,11 @@ % get the time periods of interest t0b datetime = ZmapGlobal.Data.t0b; teb datetime = ZmapGlobal.Data.teb; - t1 datetime = ZmapGlobal.Data.t0b; - t2 datetime = ZmapGlobal.Data.t0b + ([ ZmapGlobal.Data.teb - ZmapGlobal.Data.t0b])/2; + StartA datetime = ZmapGlobal.Data.t0b; + EndA datetime = ZmapGlobal.Data.t0b + ([ ZmapGlobal.Data.teb - ZmapGlobal.Data.t0b])/2; - t3 datetime = ZmapGlobal.Data.t0b + ([ ZmapGlobal.Data.teb - ZmapGlobal.Data.t0b])/2 + seconds(.1); - t4 datetime = ZmapGlobal.Data.teb; + StartB datetime = ZmapGlobal.Data.t0b + ([ ZmapGlobal.Data.teb - ZmapGlobal.Data.t0b])/2 + seconds(.1); + EndB datetime = ZmapGlobal.Data.teb; mcAuto McAutoEstimate = true; wtAuto LSWeightingAutoEstimate = true; end @@ -23,109 +23,74 @@ properties(Constant) PlotTag = 'bcrossVt2' ReturnDetails = cell2table({... VariableNames, VariableDescriptions, VariableUnits - 'b_value_1', 'b-value I', '';...1 bv > valueMap [discarded later] - 'Mc_value1', 'Magnitude of Completion (Mc) I', '';...2 magco > old1 - 'stan1','error in b I','';...9 stan > stanm - 'a_value1', 'a-value I', '';... 8 av > avm - 'probability', 'Probability I','';...7 pr > pro - 'count_1', 'Number of events I','';... + 'b_value_1' , 'b-value I', '';...1 bv > valueMap [discarded later] + 'Mc_value1' , 'Magnitude of Completion (Mc) I', '';...2 magco > old1 + 'stan1' , 'error in b I', '';...9 stan > stanm + 'a_value1' , 'a-value I', '';... 8 av > avm + 'probability', 'Probability I', '';...7 pr > pro + 'count_1' , 'Number of events I', '';... ... - 'b_value_2', 'b-value II', '';...1 bv2 > valueMap [discarded later] - 'Mc_value2', 'Magnitude of Completion (Mc) II', '';...2 magco2 > old1 - 'stan2','error in b II','';...9 stan2 > stanm - 'a_value2', 'a-value II', '';... 8 av2 > avm - 'probability2', 'Probability II','';...7 pr2 > pro - 'count_2', 'Number of events II','';... + 'b_value_2' , 'b-value II', '';...1 bv2 > valueMap [discarded later] + 'Mc_value2' , 'Magnitude of Completion (Mc) II', '';...2 magco2 > old1 + 'stan2' , 'error in b II', '';...9 stan2 > stanm + 'a_value2' , 'a-value II', '';... 8 av2 > avm + 'probability2', 'Probability II', '';...7 pr2 > pro + 'count_2' , 'Number of events II', '';... ... - 'distance_along_strike','distance along cross-section strike','km';... - 'dM','Difference in Mc','mag';... Mc_value2 - Mc_value1 (Not)maxm-magco - 'delta_bval','Difference in b-values','';... old - meg : BV2 - BV1 - 'dbperc','b-value change','pct';... bv2/bv*100-100 + 'dM' , 'Difference in Mc', 'mag';... Mc_value2 - Mc_value1 (Not)maxm-magco + 'delta_bval', 'Difference in b-values', '';... old - meg : BV2 - BV1 + 'dbperc' , 'b-value change', 'pct';... bv2/bv*100-100 }, 'VariableNames', {'Names','Descriptions','Units'}); + % fields returned by the calculation. must match column 1 of ReturnDetails CalcFields = {... 'b_value_1','Mc_value1','stan1','a_value1','probability','count_1',... 'b_value_2','Mc_value2', 'stan2','a_value2','probability2','count_2'}; - References=""; - % [bv magco stan av pr no1 bv2 magco2 stan2 av2 pr2 no2] % changed to return relevent properies - %{ - ReturnDetailsOld = {... VariableNames, VariableDescriptions, VariableUnits - - 'b_value_1', 'Mcomp b-value I', '';...1 bv > valueMap [discarded later] - 'Mc_value', 'Magnitude of Completion (Mc)', '';...2 magco > old1 - 'x', 'Longitude', 'deg';... 3 x - 'y', 'Latitude', 'deg';... 4 y - 'Number_of_Events', 'Number of events in node', ''...5 b.Count > r [INCORRECT] - 'b_value_2', 'b-value II', '';...6 bv2 > meg - 'probability', 'Probability','';...7 pr > pro - 'a_value', 'a-value', '';... 8 av > avm - 'stan','error in b','';...9 stan > stanm - 'maxmag','maximum magnitude','mag';... 10 max(b.Magnitude) or maxm > Mmax - 'delta_bv','difference in b-values',''; ... 11 bv-bv2 > -db12 (negative? why?) - 'probability', 'probability again. same one.','';...12 pr - 'dbperc','b-value change','pct'...13 bv2/bv*100-100 - - % bv magco x y b.Count bv2 pr av stan max(b.Magnitude) bv-bv2 pr bv2/bv*100-100 - 'Radius_km', 'Radius of chosen events (Resolution) [km]', 'km';... - 'dM','Difference from Mc','mag';...maxm-magco - 'd_b','Difference in b','';... old - meg - 'Number_of_Events', 'Number of events in node', ''... - }; - %} + ParameterableProperties = ["NodeMinEventCount", "StartA", "EndA", "StartB", "EndB",... + "mcAuto", "wtAuto"] + + References = "" + end methods - function obj=bcrossVt2(catalog, varargin) + function obj=bcrossVt2(zap, varargin) obj@ZmapVGridFunction(zap, 'd_b'); obj.NodeMinEventCount = 100; - report_this_filefun(); - unimplemented_error() obj.parseParameters(varargin); obj.StartProcess(); end + function InteractiveSetup(obj) report_this_filefun(); - %ZG=ZmapGlobal.Data; - - sdlg.prompt='T1 = '; sdlg.value=obj.t1; - sdlg(2).prompt='T2 = '; sdlg(2).value=obj.t2; - sdlg(3).prompt='T3 = '; sdlg(3).value=obj.t3; - sdlg(4).prompt='T4 = '; sdlg(4).value=obj.t4; - sdlg(5).prompt='NodeMinEventCount'; sdlg(5).value=obj.NodeMinEventCount; - [~,~,obj.t1,obj.t2,obj.t3,obj.t4,obj.NodeMinEventCount]=smart_inputdlg('differential b-value map', sdlg); - %% make the interface zdlg = ZmapDialog(); - %zdlg = ZmapDialog(obj, @obj.doIt); - zdlg.AddHeader('Automatically estimate magnitude of completeness?'); zdlg.AddMcAutoEstimateCheckbox('mcAuto', obj.mcAuto); zdlg.AddCheckbox('wtAuto', 'AUTOMATIC Least Squares Weighting', obj.wtAuto,... - 'Choose the calculation weighting method for Mc'); - zdlg.AddGridSpacing('gridOpts',obj.dx,'km',[],'',obj.dd,'km'); - obj.AddDialogOption(zdlg,'EventSelector'); - obj.AddDialogOption(zdlg,'NodeMinEventCount'); - - - [res,okPressed] = zdlg.Create('Name', 'differential b-value map X-section Grid Parameters'); - - if ~okPressed - return - end - obj.SetValuesFromDialog(res) - obj.doIt(); + [],'Choose the calculation weighting method for Mc'); + % obj.AddDialogOption(zdlg,'EventSelector'); + obj.AddDialogOption(zdlg, 'NodeMinEventCount'); + zdlg.AddHeader('Catalog Part A') + zdlg.AddEdit('StartA', 'Start Date', obj.StartA, ''); + zdlg.AddEdit('EndA', 'End Date', obj.EndA, ''); + zdlg.AddHeader('Catalog Part B') + zdlg.AddEdit('StartB', 'Start Date', obj.StartB, ''); + zdlg.AddEdit('EndB', 'End Date', obj.EndB, ''); + + zdlg.Create('Name', 'differential b-value map X-section Grid Parameters', 'WriteToObj', obj, 'OkFcn', @obj.doIt); end function SetValuesFromDialog(obj,res) % called when the dialog's OK button is pressed obj.mcAuto = res.mcAuto; % MC Calculation using Max Likelihood automatic Mcomp obj.wtAuto = res.wtAuto; % 1 is automatic LSW, 2 is not automatic - obj.dx=res.gridOpts.dx; - obj.dd=res.gridOpts.dz; + obj.dx = res.gridOpts.dx; + obj.dd = res.gridOpts.dz; obj.ni = res.eventSelector.NumClosestEvents; obj.ra = res.eventSelector.RadiusKm; obj.NodeMinEventCount = res.eventSelector.requiredNumEvents; @@ -137,59 +102,11 @@ function SetValuesFromDialog(obj,res) % to each grid point function results = Calculate(obj) - %{ - figure(xsec_fig()); - set(gca,'NextPlot','add') - - ax=findobj(gcf,'Tag','mainmap_ax'); - [x,y, mouse_points_overlay] = select_polygon(ax); - - - plos2 = plot(x,y,'b-'); % plot outline - sum3 = 0.; - pause(0.3) - - %create a rectangular grid - xvect=[min(x):dx:max(x)]; - yvect=[min(y):dd:max(y)]; - gx = xvect;gy = yvect; - tmpgri=zeros((length(xvect)*length(yvect)),2); - n=0; - for i=1:length(xvect) - for j=1:length(yvect) - n=n+1; - tmpgri(n,:)=[xvect(i) yvect(j)]; - end - end - %extract all gridpoints in chosen polygon - XI=tmpgri(:,1); - YI=tmpgri(:,2); - - ll = polygon_filter(x,y, XI, YI, 'inside'); - %grid points in polygon - newgri=tmpgri(ll,:); - - % Plot all grid points - plot(newgri(:,1),newgri(:,2),'+k') - - if length(xvect) < 2 || length(yvect) < 2 - errordlg('Selection too small! (not a matrix)'); - return - end - - itotal = length(newgri(:,1)); - - %} % make grid, calculate start- endtime etc. ... % n = obj.RawCatalog.Count; - - % set mainshock magnitude to ZG.CatalogOpts.BigEvents.MinMag - % f = find(newa(:,6) == max(newa(:,6))) - % newa(f,6) = min(newa(:,6)); - - + % overall b-value bv = bvalca3(obj.RawCatalog.Magnitude, obj.mcAuto); b_value_overall = bv; @@ -200,127 +117,75 @@ function SetValuesFromDialog(obj,res) returnDesc = obj.ReturnDetails.Descriptions; returnUnits = obj.ReturnDetails.Units; - [bvg,nEvents,maxDists,maxMag, ll]=gridfun(@calculation_function,obj.RawCatalog,obj.Grid, obj.EventSelector, numel(returnFields)); - - - bvg(:,strcmp('delta_bval',returnFields))=bvg(:,strcmp('b_value_2',returnFields)) - bvg(:,strcmp('b_value_1',returnFields)); + obj.gridCalculations(@do_calculation, @modification_function); - bvg(:,strcmp('dM',returnFields))=bvg(:,strcmp('Mc_value2',returnFields)) - bvg(:,strcmp('Mc_value_1',returnFields)); - - bvg(:,strcmp('dbperc',returnFields))=bvg(:,strcmp('b_value_2',returnFields))/bvg(:,strcmp('b_value_1',returnFields)) .* 100 - 100; - - bvg(:,strcmp('x',returnFields))=obj.Grid.X(:); - bvg(:,strcmp('y',returnFields))=obj.Grid.Y(:); - bvg(:,strcmp('z',returnFields))=obj.Grid.Z(:); - bvg(:,strcmp('Number_of_Events',returnFields))=nEvents; - bvg(:,strcmp('Radius_km',returnFields))=maxDists; - bvg(:,strcmp('max_mag',returnFields))=maxMag; - - - myvalues = array2table(bvg,'VariableNames', returnFields); - myvalues.Properties.VariableDescriptions = returnDesc; - myvalues.Properties.VariableUnits = returnUnits; - - %kll = ll; - obj.Result.values=myvalues; if nargout - results=myvalues; + results = obj.Result.values; end - %{ - % reshape a few matrices - % - normlap2=nan(length(tmpgri(:,1)),1) - normlap2(ll)= bvg(:,1); - valueMap=reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,2); - old1 =reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,5); - r =reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,6); - meg=reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,7); - pro=reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,8); - avm=reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,9); - stanm=reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,10); - maxm=reshape(normlap2,length(yvect),length(xvect)); - - normlap2(ll)= bvg(:,11); - db12=reshape(normlap2,length(yvect),length(xvect)); - db12 = -db12; - - normlap2(ll)= bvg(:,13); - dbperc=reshape(normlap2,length(yvect),length(xvect)); - - - valueMap = db12; - old = valueMap; - %} % View the b-value map % TODO: PLOTTING SHOULD BE HANDLED BY THE ZMAPGRIDFUNCTION class - view_bvt([],valueMap) + % view_bvt([],valueMap) + + function tb = modification_function(tb) + tb.delta_bval = tb.b_value_2 - tb.b_value_1; + tb.dM = tb.Mc_value2 - tb.Mc_value1; + tb.dbperc = tb.b_value_2 ./ tb.b_value_1 .* 100 - 100; + end - function out=calculation_function(catalog) + function out = do_calculation(catalog, calcFcn) + % calculate values at a single point + out = nan(1,12); + + % Added to obtain goodness-of-fit to powerlaw value + [~, ~, ~, ~, out(7)] = mcperc_ca3(catalog.Magnitude); + Mc_value = mcCalculator(catalog); + + idx = catalog.Magnitude >= Mc_value-(obj.fBinning/2); + nEvents_gt_local_mc = sum(idx); + + out(11) = nEvents_gt_local_mc; + + if nEvents_gt_local_mc >= obj.NodeMinEventCount + out = calcFcn(catalog, idx, out); % runs either calculation_function_boot or calculation_function_noboot + else + out(10) = 1; + end + end + + function out = calculation_function(catalog) % The guts of calculating at an individual point goes here - %{ - x = catalog(i,1);y = catalog(i,2); - allcount = allcount + 1.; - i2 = i2+1; + out = NaN(1,12); % [bv magco stan av pr no1 bv2 magco2 stan2 av2 pr2 no2]; + out([5,11]) = 50; % set pr and pr2; + out([6,12]) = 0; % set no1 and no2; + tmp = out; % [bv magco stan av pr no1 bv2 magco2 stan2 av2 pr2 no2]; - % calculate distance from center point and sort wrt distance - l = sqrt(((xsecx' - x)).^2 + ((xsecy + y)).^2) ; - %[s,is] = sort(l); - %catalog = newa(is(:,1),:) ; % re-orders matrix to agree row-wise - % take first ni points - l = l <= ra; - catalog = newa.subset(l); % new data per grid point (catalog) is sorted in distance - %} - if catalog.Count >= obj.NodeMinEventCount minForTimeslice = obj.NodeMinEventCount/2; % call the catalog-value function % this was [apparently] sloppy, output values migth be result of one or the other % catalog piece, depending on the number of events. - lt = catalog.Date >= obj.t1 & catalog.Date < obj.t2; + lt = catalog.Date >= obj.StartA & catalog.Date < obj.EndA; count1 = sum(lt); - bv = NaN; pr = 50; no1=0;stan1=NaN;av=NaN; pr=NaN; magco=NaN; if count1 > minForTimeslice - [bv, magco, stan, av, pr] = bvalca3(catalog.Magnitude(lt),obj.mcAuto, b_value_overall); + [tmp(1), tmp(2), tmp(3), tmp(4), tmp(5)] = bvalca3(catalog.Magnitude(lt), obj.mcAuto, b_value_overall); obj.ZG.overall_b_value = bv; - no1 = count1; + tmp(6) = count1; end - lt = catalog.Date >= obj.t3 & catalog.Date < obj.t4 ; + lt = catalog.Date >= obj.StartB & catalog.Date < obj.EndB ; count2 = sum(lt); - bv2 = NaN; pr2=50; no2=0; stan2=NaN; av2=NaN; pr2=NaN; magco2=NaN; if count2 > minForTimeslice - [bv2, magco2, stan2, av2, pr2] = bvalca3(catalog.Magnitude(lt),obj.mcAuto, b_value_overall); - no2=count2; + [tmp(7), tmp(8), tmp(9), tmp(10), tmp(11)] = bvalca3(catalog.Magnitude(lt), obj.mcAuto, b_value_overall); + tmp(12) = count2; end if pr2 >= 99 % don't know what [specifically] this is accomplishing. - out = [bv magco stan av pr no1 bv2 magco2 stan2 av2 pr2 no2]; % changed to return relevent properies - %out = [bv magco x y catalog.Count bv2 pr av stan max(catalog.Magnitude) bv-bv2 pr bv2/bv*100-100]; - else - out = [0 NaN(1,11)]; - %out = [0 NaN x y NaN NaN NaN NaN NaN NaN 0 NaN NaN]; + out = tmp; % changed to return relevent properies end - else - out = NaN(1,12); - %out = [NaN NaN x y NaN NaN NaN NaN NaN NaN 0 NaN NaN]; end end end @@ -335,6 +200,7 @@ function my_load() load_existing_bgrid_version_A end end + methods(Static) function h = AddMenuItem(parent, zapFcn, varargin) % create a menu item diff --git a/src/+XZfun/calc_Omoricross.m b/src/+XZfun/calc_Omoricross.m index 909b70af..702dcdc0 100644 --- a/src/+XZfun/calc_Omoricross.m +++ b/src/+XZfun/calc_Omoricross.m @@ -6,7 +6,7 @@ bootloops double = 50 learningPeriod duration = days(100) Nmin double = 50 - MainShock ZMapCatalog + MainShock ZmapCatalog MainShockSelection char {mustBeMember({'Largest','FirstInGlobal','LargestInXsection'})} = 'Largest' end diff --git a/src/@ZmapMainWindow/catalog_menu.m b/src/@ZmapMainWindow/catalog_menu.m index f8dd7c1e..9e756821 100644 --- a/src/@ZmapMainWindow/catalog_menu.m +++ b/src/@ZmapMainWindow/catalog_menu.m @@ -55,7 +55,9 @@ % choose a time range by clicking on the axes. only available if x-axis is a datetime axis. uimenu(submenu,'Label','Rename...',MenuSelectedField(),@cb_rename); - + uimenu(submenu,'Separator','on',... + 'Label','Remove inactive events',... + MenuSelectedField(), @cb_usesubset); uimenu(submenu,'Separator','on',... 'Label','Memorize Catalog', MenuSelectedField(), @cb_memorize); uimenu(submenu,'Label','Recall Catalog', MenuSelectedField(), @cb_recall); @@ -114,6 +116,15 @@ function cb_clearmemorized(~,~) end end + function cb_usesubset(~,~) + ZG = ZmapGlobal.Data; + ZG.primeCatalog = obj.catalog; + obj.rawcatalog = obj.catalog; + obj.map_axes.XLim = bounds2(obj.catalog.X); + obj.map_axes.YLim = bounds2(obj.catalog.Y); + obj.replot_all; + end + function [catalog,ok]=cb_catalog_from_workspace(opt, fn) % TODO Implement this! %fig=ancestor(src,'figure'); diff --git a/src/ZmapAnalysisPkg.m b/src/ZmapAnalysisPkg.m index f7f7b502..24b11002 100644 --- a/src/ZmapAnalysisPkg.m +++ b/src/ZmapAnalysisPkg.m @@ -22,7 +22,7 @@ properties(SetAccess = immutable) % can only be set in constructor - Catalog % a ZMapCatalog. Do not change this catalog directly + Catalog % a ZmapCatalog. Do not change this catalog directly EventSel EventSelectionParameters Grid {mustBeZmapGrid} = ZmapGrid()% ZmapGrid used to sample at points in space Shape % Shape used to mask a catalog diff --git a/src/ZmapData.m b/src/ZmapData.m index a6e9464e..02578b33 100644 --- a/src/ZmapData.m +++ b/src/ZmapData.m @@ -269,7 +269,11 @@ end function c = get.primeCatalog(obj) - c = obj.catalogs.get('prime'); + try + c = obj.catalogs.get('prime'); + catch + c = ZmapCatalog(); + end end function set.primeCatalog(obj, val) obj.catalogs.set('prime', val); diff --git a/src/ZmapSettings.mlapp b/src/ZmapSettings.mlapp index 8467eaa6..3a032026 100644 Binary files a/src/ZmapSettings.mlapp and b/src/ZmapSettings.mlapp differ