def _assert_shielding(raw_sss, erm_power, shielding_factor, meg='mag'):
 picks = pick_types(raw_sss.info, meg=meg, ref_meg=False)
 if isinstance(erm_power, BaseRaw):
  picks_erm = pick_types(raw_sss.info, meg=meg, ref_meg=False)
  assert_allclose(picks, picks_erm)
  erm_power = np.sqrt((erm_power[picks_erm][0] ** 2).sum())
 sss_power = raw_sss[picks][0].ravel()
 sss_power = np.sqrt(np.sum((sss_power * sss_power)))
 factor = (erm_power / sss_power)
 assert_true((factor >= shielding_factor), ('Shielding factor %0.3f < %0.3f' % (factor, shielding_factor)))

def _assert_shielding ( raw_sss , erm_power , shielding_factor , meg = 'mag' ) : picks = pick_types ( raw_sss . info , meg = meg , ref_meg = False ) if isinstance ( erm_power , BaseRaw ) : picks_erm = pick_types ( raw_sss . info , meg = meg , ref_meg = False ) assert_allclose ( picks , picks_erm ) erm_power = np . sqrt ( ( erm_power [ picks_erm ] [ 0 ] ** 2 ) . sum ( ) ) sss_power = raw_sss [ picks ] [ 0 ] . ravel ( ) sss_power = np . sqrt ( np . sum ( ( sss_power * sss_power ) ) ) factor = ( erm_power / sss_power ) assert_true ( ( factor >= shielding_factor ) , ( 'Shielding factor %0.3f < %0.3f' % ( factor , shielding_factor ) ) )
helper to assert a minimum shielding factor using empty-room power .