from neurotrends.config import re
from neurotrends.tagger import rex_compile, rex_flex, rex_ctx, rex_named
from neurotrends.tagger import CustomTagger
from ..misc import delimiter, float_ptn

mm_ptn = r'(mm|milli{dlm}met(er|re)s?)'.format(dlm=delimiter)
fw_ptn = r'(fwhm|full{dlm}width)'.format(dlm=delimiter)
hm_ptn = r'(fwhm|half{dlm}max(imum)?)'.format(dlm=delimiter)

smooth_spatial_ptn = [
    r'{num}{dlm}{mm}{dlm}{fw}'.format(
        num=rex_named(float_ptn, 'kernel'),
        mm=mm_ptn,
        fw=fw_ptn,
        dlm=delimiter,
    ), r'''
        {halfmax}{dlm}
        (of|at|(set{dlm}to)|(equal{dlm}to))?{dlm}
        ({num}){dlm}{mm}
    '''.format(
        dlm=delimiter,
        halfmax=hm_ptn,
        num=rex_named(float_ptn, 'kernel'),
        mm=mm_ptn,
    )
]
smooth_spatial_ptn = [rex_compile(ptn) for ptn in smooth_spatial_ptn]

MAX_FWHM = 30

        r'mastoid',
        r'amplifi',
        r'electrode',
        r'alpha',
        r'beta',
        r'delta',
        r'gamma',
        r'vocal',
        r'word',
    ]
]

highpass_filter_values_fraction = rex_compile(
    ur'(?<![\d\-\u2212]\s){num1}{dlm}[/\u2044]{dlm}{num2}{dlm}{unit}'.format(
        dlm=delimiter,
        num1=rex_named(float_ptn, 'num'),
        num2=rex_named(float_ptn, 'dnm'),
        unit=rex_named(hpf_unit_ptn, 'units'),
    )
)
highpass_filter_values = rex_compile(
    ur'(?<![\d\-\u2212]\s){num}{dlm}{unit}'.format(
        dlm=delimiter,
        num=rex_named(float_ptn, 'cutoff'),
        unit=rex_named(hpf_unit_ptn, 'units'),
    )
)

highpass_filter_bool_ptn = [
    rex_compile(ptn)
    for ptn in highpass_filter_bool_ptn
Exemple #3
0
from neurotrends.tagger import CustomTagger
from ..misc import delimiter

MIN_FIELD_STRENGTH = 0.5
MAX_FIELD_STRENGTH = 12

# Magnet patterns
vend_ptn = r'siemens|philips|general{dlm}electric|\Wge\W'.format(dlm=delimiter)
scan_ptn = r'magnet|scan(ner)?|mri|field|system'
mag_ptn = r'({vend}|{scan})'.format(vend=vend_ptn, scan=scan_ptn)

tesla_ptn = r'(tesla|t(?!\w|{dlm}=|{dlm}\d+|\())'.format(dlm=delimiter)
num_ptn = r'[\s\(](\d{1,2}\.?\d{,2})(?!=\d)'

field_ptn = [
    rex_compile(rex_named(num_ptn, 'field') + delimiter + tesla_ptn),
]

sig_ptn = 'p{dlm}[<=>]+{dlm}\d?\.\d+'.format(dlm=delimiter)
sig_ptn = rex_compile(sig_ptn)


def est_field_strength(txt):

    fields = []

    for ptn in field_ptn:

        matches = rex_flex(ptn, txt, fun=re.finditer)

        for match in matches:
from neurotrends.config import re
from neurotrends.tagger import rex_compile, rex_flex, rex_ctx, rex_named
from neurotrends.tagger import CustomTagger
from ..misc import delimiter, float_ptn

mm_ptn = r'(mm|milli{dlm}met(er|re)s?)'.format(dlm=delimiter)
fw_ptn = r'(fwhm|full{dlm}width)'.format(dlm=delimiter)
hm_ptn = r'(fwhm|half{dlm}max(imum)?)'.format(dlm=delimiter)

smooth_spatial_ptn = [
    r'{num}{dlm}{mm}{dlm}{fw}'.format(
        num=rex_named(float_ptn, 'kernel'),
        mm=mm_ptn,
        fw=fw_ptn,
        dlm=delimiter,
    ),
    r'''
        {halfmax}{dlm}
        (of|at|(set{dlm}to)|(equal{dlm}to))?{dlm}
        ({num}){dlm}{mm}
    '''.format(
        dlm=delimiter,
        halfmax=hm_ptn,
        num=rex_named(float_ptn, 'kernel'),
        mm=mm_ptn,
    )
]
smooth_spatial_ptn = [
    rex_compile(ptn) for ptn in smooth_spatial_ptn
]
from neurotrends.tagger import CustomTagger
from ..misc import delimiter

MIN_FIELD_STRENGTH = 0.5
MAX_FIELD_STRENGTH = 12

# Magnet patterns
vend_ptn = r'siemens|philips|general{dlm}electric|\Wge\W'.format(dlm=delimiter)
scan_ptn = r'magnet|scan(ner)?|mri|field|system'
mag_ptn = r'({vend}|{scan})'.format(vend=vend_ptn, scan=scan_ptn)

tesla_ptn = r'(tesla|t(?!\w|{dlm}=|{dlm}\d+|\())'.format(dlm=delimiter)
num_ptn = r'[\s\(](\d{1,2}\.?\d{,2})(?!=\d)'

field_ptn = [
    rex_compile(rex_named(num_ptn, 'field') + delimiter + tesla_ptn),
]

sig_ptn = 'p{dlm}[<=>]+{dlm}\d?\.\d+'.format(dlm=delimiter)
sig_ptn = rex_compile(sig_ptn)

def est_field_strength(txt):

    fields = []

    for ptn in field_ptn:

        matches = rex_flex(ptn, txt, fun=re.finditer)

        for match in matches:
        r"mastoid",
        r"amplifi",
        r"electrode",
        r"alpha",
        r"beta",
        r"delta",
        r"gamma",
        r"vocal",
        r"word",
    ]
]

highpass_filter_values_fraction = rex_compile(
    ur"(?<![\d\-\u2212]\s){num1}{dlm}[/\u2044]{dlm}{num2}{dlm}{unit}".format(
        dlm=delimiter,
        num1=rex_named(float_ptn, "num"),
        num2=rex_named(float_ptn, "dnm"),
        unit=rex_named(hpf_unit_ptn, "units"),
    )
)
highpass_filter_values = rex_compile(
    ur"(?<![\d\-\u2212]\s){num}{dlm}{unit}".format(
        dlm=delimiter, num=rex_named(float_ptn, "cutoff"), unit=rex_named(hpf_unit_ptn, "units")
    )
)

highpass_filter_bool_ptn = [rex_compile(ptn) for ptn in highpass_filter_bool_ptn]


def est_highpass_cutoff(txt):
    """
Exemple #7
0
        r'mastoid',
        r'amplifi',
        r'electrode',
        r'alpha',
        r'beta',
        r'delta',
        r'gamma',
        r'vocal',
        r'word',
    ]
]

highpass_filter_values_fraction = rex_compile(
    ur'(?<![\d\-\u2212]\s){num1}{dlm}[/\u2044]{dlm}{num2}{dlm}{unit}'.format(
        dlm=delimiter,
        num1=rex_named(float_ptn, 'num'),
        num2=rex_named(float_ptn, 'dnm'),
        unit=rex_named(hpf_unit_ptn, 'units'),
    ))
highpass_filter_values = rex_compile(
    ur'(?<![\d\-\u2212]\s){num}{dlm}{unit}'.format(
        dlm=delimiter,
        num=rex_named(float_ptn, 'cutoff'),
        unit=rex_named(hpf_unit_ptn, 'units'),
    ))

highpass_filter_bool_ptn = [
    rex_compile(ptn) for ptn in highpass_filter_bool_ptn
]