Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lixun910 committed Mar 6, 2019
1 parent 9776eb2 commit c0763c2
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Explore/LisaMapNewView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ void LisaMapFrame::OnSaveResult(wxCommandEvent& event)
data[3].type = GdaConst::double_type;
data[3].undefined = &undefs;
}

std::vector<double> ebr(lisa_coord->num_obs);
if (lc->is_rate) {
std::vector<double> ebr(lisa_coord->num_obs);
for (int i=0, iend=lisa_coord->num_obs; i<iend; i++) {
ebr[i] = lisa_coord->smoothed_results[t][i];
}
Expand Down
18 changes: 14 additions & 4 deletions Explore/LisaScatterPlotView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,11 +941,9 @@ void LisaScatterPlotCanvas::SaveMoranI()
std::vector<double> lag(num_obs);
std::vector<double> 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<num_obs; i++) {
std_data[i] = x_data[xt][i];
lag[i] = y_data[yt][i];
Expand All @@ -959,7 +957,7 @@ void LisaScatterPlotCanvas::SaveMoranI()

std::vector<SaveToTableEntry> data;

if (is_diff) {
if (is_diff || is_rate) {
data.resize(3);
} else {
data.resize(2);
Expand All @@ -984,7 +982,19 @@ void LisaScatterPlotCanvas::SaveMoranI()
data[2].type = GdaConst::double_type;
data[2].undefined = &XYZ_undef;
}


std::vector<double> 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; i<iend; i++) {
ebr[i] = lisa_coord->smoothed_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();
Expand Down
6 changes: 4 additions & 2 deletions Explore/LocalGearyCoordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
25 changes: 13 additions & 12 deletions Explore/LocalGearyMapNewView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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<iend; i++) {
if (p[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);
Expand Down Expand Up @@ -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<iend; i++) {
if (p[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);
Expand Down
2 changes: 1 addition & 1 deletion Explore/MLJCCoordinator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c0763c2

Please sign in to comment.