Пример #1
0
# Articles Object
# ~~~~~~~~~~~~~~~
#
# LISC uses a custom objects to store and organize collected words data.
#
# These objects are used internally in the :class:`~.Words` objects.
#
# If the data collection was set to save out data as it was collected, then
# :obj:`~.Articles` objects can be loaded individually, using the label
# of the search term.
#

###################################################################################################

# Set up database object
db = SCDB('lisc_db')

# Load raw data for a particular term
term = 'frontal lobe'
arts = Articles(term)
arts.load(db)

###################################################################################################
# ArticlesAll Object
# ~~~~~~~~~~~~~~~~~~
#
# There is also the :obj:`~.ArticlesAll` object, which is variant which can be used
# to aggregate collected data across all articles collected for a given search term.
#
# The :obj:`~.ArticlesAll` object also has methods to create and check summaries
# created from the aggregate data, across all articles for a given search term.
Пример #2
0
from lisc.utils.io import load_object

###################################################################################################
# Metadata
# --------
#
# Whenever you collect data with LISC, meta data is collected about the API requests
# and databases accessed.
#
# Here we will explore the metadata collected during our previous investigations.
#

###################################################################################################

# Reload the counts object
counts = load_object('tutorial_counts', SCDB('lisc_db'))

###################################################################################################
# Metadata Object
# ---------------
#
# Metadata information is collected into a custom :class:`~.MetaData` object.
#
# If you are collecting data using the LISC object, such as the :class:`~.Counts`
# or :class:`~.Words` object, this collection information is attached and saved
# to the object as the `meta_data` attribute.
#

###################################################################################################

# Check the date on which the collection happened
Пример #3
0
           ['occipital lobe']]
terms_b = [['vision'], ['audition', 'auditory'], ['somatosensory'],
           ['olfaction', 'smell'], ['gustation', 'taste'], ['proprioception'],
           ['nociception', 'pain']]

###################################################################################################

# Set terms lists
#  Different terms lists are indexed by the 'A' and 'B' labels
counts.add_terms(terms_a, dim='A')
counts.add_terms(terms_b, dim='B')

###################################################################################################

# Collect co-occurrence data
counts.run_collection()

###################################################################################################
#
# From there you can use all the same methods to explore the data we just collected.
#
# In the next tutorial, we explore analyzing our collected counts data.
#
# For now, let's save out our collected counts data, using the LISC utility to save the object.
#

###################################################################################################

# Save out the counts object
save_object(counts, 'tutorial_counts', directory=SCDB('lisc_db'))
Пример #4
0
# Word Collection Settings
# ~~~~~~~~~~~~~~~~~~~~~~~~
#
# For larger collections, the collectio my take a while and return a large amount of data.
#
# Because of this, the :class:`~.Words` object allows for continuously saving collected data.
# If set to True, the `save_and_clear` parameter saves out collected data, and clears the
# object per term, so that collected data does not have to stay in RAM.
#
# Now, let's run our bigger collection, using some of these settings.
#

###################################################################################################

# Set up our database object, so we can save out data as we go
db = SCDB('lisc_db')

# Collect words data
words.run_collection(usehistory=True, retmax=15, save_and_clear=True, directory=db)

###################################################################################################
#
# After this collection, the Words object does not actually include the collected data,
# as the data was saved and cleared throughout the collection.
#
# The Words object does still have all the information about the search terms, which we can
# use to reload our data, so it is still worth saving as well.
#
# We will analyze our words data in the next tutorial. For now lets save out the Words object.
#
Пример #5
0
    def __init__(self):

        # Initialize from normal database object
        base = pkg.resource_filename(__name__, 'test_db')
        SCDB.__init__(self, base=base)
Пример #6
0
# Articles Object
# ~~~~~~~~~~~~~~~
#
# LISC uses custom objects to store and organize collected words data.
#
# These objects are used internally in the :class:`~.Words` objects.
#
# If the data collection was set to save out data as it was collected, then
# :obj:`~.Articles` objects can be loaded individually, using the label
# of the search term.
#

###################################################################################################

# Set up database object
db = SCDB('lisc_db')

# Load raw data for a particular term
term = 'frontal lobe'
arts = Articles(term)
arts.load(db)

###################################################################################################
# ArticlesAll Object
# ~~~~~~~~~~~~~~~~~~
#
# The :obj:`~.ArticlesAll` object aggregates collected data across all articles collected
# for a given search term.
#

###################################################################################################