Example #1
0
 def test_zmap(self):
     # This is not in R, so tested by using:
     #    (testcase[i]-mean(testcase,axis=0)) / sqrt(var(testcase)*3/4)
     y = mstats.zmap(self.testcase, self.testcase)
     desired_unmaskedvals = ([-1.3416407864999, -0.44721359549996,
                              0.44721359549996, 1.3416407864999])
     assert_array_almost_equal(desired_unmaskedvals,
                               y.data[y.mask == False], decimal=12)
Example #2
0
 def test_zmap(self):
     # This is not in R, so tested by using:
     #    (testcase[i]-mean(testcase,axis=0)) / sqrt(var(testcase)*3/4)
     y = mstats.zmap(self.testcase, self.testcase)
     desired_unmaskedvals = ([-1.3416407864999, -0.44721359549996,
                              0.44721359549996, 1.3416407864999])
     assert_array_almost_equal(desired_unmaskedvals,
                               y.data[y.mask == False], decimal=12)
Example #3
0
def standardize_pow_mat(stripped_pow_mat, events, sessions, outsample_session=None, outsample_list=None):
    zpow_mat = np.array(stripped_pow_mat)
    outsample_mask = None
    for session in sessions:
        sess_event_mask = (events.session == session)
        if session == outsample_session:
            outsample_mask = (events.list == outsample_list) & sess_event_mask
            insample_mask = ~outsample_mask & sess_event_mask
            zpow_mat[outsample_mask] = zmap(zpow_mat[outsample_mask], zpow_mat[insample_mask], axis=0, ddof=1)
            zpow_mat[insample_mask] = zscore(zpow_mat[insample_mask], axis=0, ddof=1)
        else:
            zpow_mat[sess_event_mask] = zscore(zpow_mat[sess_event_mask], axis=0, ddof=1)
    return zpow_mat, outsample_mask
Example #4
0
def standardize_pow_mat(stripped_pow_mat,
                        events,
                        sessions,
                        outsample_session=None,
                        outsample_list=None):
    zpow_mat = np.array(stripped_pow_mat)
    outsample_mask = None
    for session in sessions:
        sess_event_mask = (events.session == session)
        if session == outsample_session:
            outsample_mask = (events.list == outsample_list) & sess_event_mask
            insample_mask = ~outsample_mask & sess_event_mask
            zpow_mat[outsample_mask] = zmap(zpow_mat[outsample_mask],
                                            zpow_mat[insample_mask],
                                            axis=0,
                                            ddof=1)
            zpow_mat[insample_mask] = zscore(zpow_mat[insample_mask],
                                             axis=0,
                                             ddof=1)
        else:
            zpow_mat[sess_event_mask] = zscore(zpow_mat[sess_event_mask],
                                               axis=0,
                                               ddof=1)
    return zpow_mat, outsample_mask