neuroscout/populate/extract.py
def _query_stim_models(dataset_name, task_name=None, graphs=None):
    """ Given a dataset and task, query all matching stimuli.
    Optionally a list of graphs can be provided which further restrict
    the stimuli to only those necessary for those graphs """

    stim_models = Stimulus.query.filter_by(active=True).filter(
        Stimulus.mimetype != 'text/csv')

    # Determine the necessary stimuli to load
    if graphs is not None:
        mimetypes = []
        for g in graphs:
            it = g.roots[0].transformer._input_type
            if not isinstance(list, it):
                it = list([it])
            for i in it:
                mimetypes.append(str(i).split('.')[-2])
        stim_models = stim_models.filter(
            Stimulus.mimetype.op('~')('|'.join(mimetypes)))

    stim_models = stim_models.join(RunStimulus).join(Run).join(Task)

    if task_name is not None:
        stim_models = stim_models.filter_by(name=task_name)

    stim_models = stim_models.join(Dataset).filter_by(name=dataset_name).all()

    if not stim_models:
        raise ValueError("No stimuli found for {dataset_name}- {task_name}!")

    return stim_models
 Given a dataset and task, query all matching stimuli.
    Optionally a list of graphs can be provided which further restrict
    the stimuli to only those necessary for those graphs 
Given a dataset and task, query all matching stimuli.
Optionally a list of graphs can be provided which further restrict
the stimuli to only those necessary for those graphs
Given a dataset and task query all matching stimuli . Optionally a list of graphs can be provided which further restrict the stimuli to only those necessary for those graphs
def _query_stim_models(dataset_name, task_name=None, graphs=None):
    stim_models = Stimulus.query.filter_by(active=True).filter(
        Stimulus.mimetype != 'text/csv')
    if graphs is not None:
        mimetypes = []
        for g in graphs:
            it = g.roots[0].transformer._input_type
            if not isinstance(list, it):
                it = list([it])
            for i in it:
                mimetypes.append(str(i).split('.')[-2])
        stim_models = stim_models.filter(
            Stimulus.mimetype.op('~')('|'.join(mimetypes)))
    stim_models = stim_models.join(RunStimulus).join(Run).join(Task)
    if task_name is not None:
        stim_models = stim_models.filter_by(name=task_name)
    stim_models = stim_models.join(Dataset).filter_by(name=dataset_name).all()
    if not stim_models:
        raise ValueError("No stimuli found for {dataset_name}- {task_name}!")
    return stim_models
def _query_stim_models ( dataset_name , task_name = None , graphs = None ) : stim_models = Stimulus . query . filter_by ( active = True ) . filter ( Stimulus . mimetype != 'text/csv' ) if graphs is not None : mimetypes = [ ] for g in graphs : it = g . roots [ 0 ] . transformer . _input_type if not isinstance ( list , it ) : it = list ( [ it ] ) for i in it : mimetypes . append ( str ( i ) . split ( '.' ) [ - 2 ] ) stim_models = stim_models . filter ( Stimulus . mimetype . op ( '~' ) ( '|' . join ( mimetypes ) ) ) stim_models = stim_models . join ( RunStimulus ) . join ( Run ) . join ( Task ) if task_name is not None : stim_models = stim_models . filter_by ( name = task_name ) stim_models = stim_models . join ( Dataset ) . filter_by ( name = dataset_name ) . all ( ) if not stim_models : raise ValueError ( "No stimuli found for {dataset_name}- {task_name}!" ) return stim_models
Given a dataset and task, query all matching stimuli.
Given a dataset and task query all matching stimuli .
""" Given a dataset and task, query all matching stimuli.
    Optionally a list of graphs can be provided which further restrict
    the stimuli to only those necessary for those graphs """ # Determine the necessary stimuli to load
dataset_name
task_name
graphs