From c0763c258437036b5a99e82b7c5ee307ed95e8f4 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Wed, 6 Mar 2019 13:36:53 -0700 Subject: [PATCH] #1828 #1830 Add option to save the standardized rates in both EB moran scatter plot and the EB local moran map add Negative category in multivariate Local Geary cluster map --- Explore/LisaMapNewView.cpp | 3 ++- Explore/LisaScatterPlotView.cpp | 18 ++++++++++++++---- Explore/LocalGearyCoordinator.cpp | 6 ++++-- Explore/LocalGearyMapNewView.cpp | 25 +++++++++++++------------ Explore/MLJCCoordinator.cpp | 2 +- version.h | 6 +++--- 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/Explore/LisaMapNewView.cpp b/Explore/LisaMapNewView.cpp index f2d70e4dd..2a72b12e4 100644 --- a/Explore/LisaMapNewView.cpp +++ b/Explore/LisaMapNewView.cpp @@ -317,8 +317,9 @@ void LisaMapFrame::OnSaveResult(wxCommandEvent& event) data[3].type = GdaConst::double_type; data[3].undefined = &undefs; } + + std::vector ebr(lisa_coord->num_obs); if (lc->is_rate) { - std::vector ebr(lisa_coord->num_obs); for (int i=0, iend=lisa_coord->num_obs; ismoothed_results[t][i]; } diff --git a/Explore/LisaScatterPlotView.cpp b/Explore/LisaScatterPlotView.cpp index 9525d5b83..4cfaeb8ec 100644 --- a/Explore/LisaScatterPlotView.cpp +++ b/Explore/LisaScatterPlotView.cpp @@ -941,11 +941,9 @@ void LisaScatterPlotCanvas::SaveMoranI() std::vector lag(num_obs); std::vector diff(num_obs); - int xt = sp_var_info[0].time-sp_var_info[0].time_min; int yt = sp_var_info[1].time-sp_var_info[1].time_min; - for (int i=0; i data; - if (is_diff) { + if (is_diff || is_rate) { data.resize(3); } else { data.resize(2); @@ -984,7 +982,19 @@ void LisaScatterPlotCanvas::SaveMoranI() data[2].type = GdaConst::double_type; data[2].undefined = &XYZ_undef; } - + + std::vector ebr(lisa_coord->num_obs); + if (is_rate) { + int t = var_info_orig[0].time-var_info_orig[0].time_min; + for (int i=0, iend=lisa_coord->num_obs; ismoothed_results[t][i]; + } + data[2].d_val = &ebr; + data[2].label = "EB Rates"; + data[2].field_default = "MORAN_EB"; + data[2].type = GdaConst::double_type; + data[2].undefined = &XYZ_undef; + } SaveToTableDlg dlg(project, this, data, title, wxDefaultPosition, wxSize(400,400)); dlg.ShowModal(); diff --git a/Explore/LocalGearyCoordinator.cpp b/Explore/LocalGearyCoordinator.cpp index eb77a744c..cd1994995 100644 --- a/Explore/LocalGearyCoordinator.cpp +++ b/Explore/LocalGearyCoordinator.cpp @@ -994,8 +994,10 @@ void LocalGearyCoordinator::CalcPseudoP_range(int obs_start, int obs_end, uint64 // positive && high-high if (cluster[cnt] == 1) cluster[cnt] = 1; // positive && low-low if (cluster[cnt] == 2) cluster[cnt] = 2; // positive && but in outlier qudrant: other pos - if (_cluster[cnt] > 2 && _cluster[cnt] < 5) // ignore neighborless & undefined + if (_cluster[cnt] > 2 && _cluster[cnt] < 5) { + // ignore neighborless & undefined _cluster[cnt] = 3; + } } } else { // negative lisasign[cnt] = -1 @@ -1006,7 +1008,7 @@ void LocalGearyCoordinator::CalcPseudoP_range(int obs_start, int obs_end, uint64 } if (local_geary_type == multivariate) { if (_cluster[cnt] < 2) // ignore neighborless & undefined - _cluster[cnt] = 0; // for multivar, only show significant positive (similar) + _cluster[cnt] = 2; // for multivar, only show significant positive (similar) } else { // negative if (_cluster[cnt] < 5) // ignore neighborless & undefined diff --git a/Explore/LocalGearyMapNewView.cpp b/Explore/LocalGearyMapNewView.cpp index f9fdab281..af0c0a073 100644 --- a/Explore/LocalGearyMapNewView.cpp +++ b/Explore/LocalGearyMapNewView.cpp @@ -336,7 +336,7 @@ void LocalGearyMapCanvas::CreateAndUpdateCategories() if (is_clust) { if (local_geary_coord->local_geary_type == LocalGearyCoordinator::multivariate) { - num_cats += 2; + num_cats += 3; } else if (local_geary_coord->local_geary_type == LocalGearyCoordinator::bivariate) { num_cats += 3; } else { @@ -353,15 +353,16 @@ void LocalGearyMapCanvas::CreateAndUpdateCategories() if (local_geary_coord->local_geary_type == LocalGearyCoordinator::multivariate) { cat_data.SetCategoryLabel(t, 1, str_positive); cat_data.SetCategoryColor(t, 1, lbl_color_dict[str_positive]); - + cat_data.SetCategoryLabel(t, 2, str_negative); + cat_data.SetCategoryColor(t, 2, lbl_color_dict[str_negative]); if (local_geary_coord->GetHasIsolates(t) && local_geary_coord->GetHasUndefined(t)) { - isolates_cat = 2; - undefined_cat = 3; + isolates_cat = 3; + undefined_cat = 4; } else if (local_geary_coord->GetHasUndefined(t)) { - undefined_cat = 2; + undefined_cat = 3; } else if (local_geary_coord->GetHasIsolates(t)) { - isolates_cat = 2; + isolates_cat = 3; } } else if (local_geary_coord->local_geary_type == LocalGearyCoordinator::bivariate) { @@ -410,11 +411,11 @@ void LocalGearyMapCanvas::CreateAndUpdateCategories() } if (local_geary_coord->local_geary_type == LocalGearyCoordinator::multivariate) { for (int i=0, iend=local_geary_coord->num_obs; i sig_cutoff && cluster[i] != 2 && cluster[i] != 3) { + if (p[i] > sig_cutoff && cluster[i] != 3 && cluster[i] != 4) { cat_data.AppendIdToCategory(t, 0, i); // not significant - } else if (cluster[i] == 2) { - cat_data.AppendIdToCategory(t, isolates_cat, i); } else if (cluster[i] == 3) { + cat_data.AppendIdToCategory(t, isolates_cat, i); + } else if (cluster[i] == 4) { cat_data.AppendIdToCategory(t, undefined_cat, i); } else { cat_data.AppendIdToCategory(t, cluster[i], i); @@ -499,11 +500,11 @@ void LocalGearyMapCanvas::CreateAndUpdateCategories() int s_f = local_geary_coord->GetSignificanceFilter(); if (local_geary_coord->local_geary_type == LocalGearyCoordinator::multivariate) { for (int i=0, iend=local_geary_coord->num_obs; i sig_cutoff && cluster[i] != 2 && cluster[i] != 3) { + if (p[i] > sig_cutoff && cluster[i] != 3 && cluster[i] != 4) { cat_data.AppendIdToCategory(t, 0, i); // not significant - } else if (cluster[i] == 2) { - cat_data.AppendIdToCategory(t, isolates_cat, i); } else if (cluster[i] == 3) { + cat_data.AppendIdToCategory(t, isolates_cat, i); + } else if (cluster[i] == 4) { cat_data.AppendIdToCategory(t, undefined_cat, i); } else { //cat_data.AppendIdToCategory(t, (sigCat[i]-s_f)+1, i); diff --git a/Explore/MLJCCoordinator.cpp b/Explore/MLJCCoordinator.cpp index 403ff6998..08a575bba 100644 --- a/Explore/MLJCCoordinator.cpp +++ b/Explore/MLJCCoordinator.cpp @@ -487,7 +487,7 @@ void JCCoordinator::CalcPseudoP() void JCCoordinator::CalcPseudoP_threaded(int t) { LOG_MSG("Entering JCCoordinator::CalcPseudoP_threaded"); - int nCPUs = 1;//GdaConst::gda_cpu_cores; + int nCPUs = GdaConst::gda_cpu_cores; if (!GdaConst::gda_set_cpu_cores) nCPUs = wxThread::GetCPUCount(); diff --git a/version.h b/version.h index ca02d71d8..965ceeee9 100644 --- a/version.h +++ b/version.h @@ -2,10 +2,10 @@ namespace Gda { const int version_major = 1; const int version_minor = 12; const int version_build = 1; - const int version_subbuild = 203; + const int version_subbuild = 205; const int version_year = 2019; - const int version_month = 2; - const int version_day = 26; + const int version_month = 3; + const int version_day = 6; const int version_night = 0; const int version_type = 2; // 0: alpha, 1: beta, 2: release }