lisc.objects.base.Base¶
- class lisc.objects.base.Base[source]¶
- A class for the base object for LISC collections and analyses. - Attributes:
 - Methods - __init__()- Initialize Base object. - add_labels(labels[, directory, ...])- Add the given list of strings as labels for the terms. - add_terms(terms[, term_type, directory, ...])- Add terms to the object. - check_terms([term_type])- Print out the current list of terms. - copy()- Return a copy of the current object. - drop_term(label)- Drop specified term(s) from the object. - get_index(label)- Get the index for a specified search term. - get_term(label)- Get a search term from the object. - make_search_term(label)- Create the combined search term for a selected term. - set_joiners([search, inclusions, exclusions])- Set joiners to use, specified for each term type. - unload_labels([verbose])- Unload labels from the object. - unload_terms([term_type, reset, verbose])- Completely unload terms from the object. - Attributes - Indicator for if the object has terms. - The labels for each term. - How many terms are included in the object. - add_labels(labels, directory=None, check_consistency=True)[source]¶
- Add the given list of strings as labels for the terms. - Parameters:
- labelslist of str or str
- Labels for each term to add to the object. If list, is assumed to be labels. If str, is assumed to be a file name to load from. 
- directorySCDB or str, optional
- Folder or database object specifying the file location, if loading from file. 
- check_consistencybool, optional, default: True
- Whether to check the object for consistency after adding labels. 
 
 
 - add_terms(terms, term_type=None, directory=None, append=False, check_consistency=True)[source]¶
- Add terms to the object. - Parameters:
- termslist or dict or str
- Terms to add to the object. If list, assumed to be terms, which can be a list of str or a list of list of str. If dict, each key should reflect a term_type, and values the corresponding terms. If str, assumed to be a file name to load from. 
- term_type{‘terms’, ‘inclusions’, ‘exclusions’}
- Which type of terms to are being added. 
- directorySCDB or str, optional
- Folder or database object specifying the file location, if loading from file. 
- appendboolean, optional, default: False
- Whether to append the new term(s) to any existing terms. If False, any prior terms are cleared prior to adding current term(s). 
- check_consistencybool, optional, default: True
- Whether to check the object for consistency after adding terms. 
 
 - Examples - Add search terms, from a list: - >>> base = Base() >>> base.add_terms(['frontal lobe', 'temporal lobe', 'parietal lobe', 'occipital lobe']) - Add inclusion terms, from a list: - >>> base.add_terms([[], ['brain'], [], []], term_type='inclusions') - Add exclusion terms, from a list: - >>> base.add_terms([['prefrontal'], [], [], []], term_type='exclusions') 
 - check_terms(term_type='terms')[source]¶
- Print out the current list of terms. - Examples - Check added terms: - >>> base = Base() >>> base.add_terms(['frontal lobe', 'temporal lobe', 'parietal lobe', 'occipital lobe']) >>> base.check_terms() List of terms used: frontal lobe : frontal lobe temporal lobe : temporal lobe parietal lobe : parietal lobe occipital lobe : occipital lobe - Attributes:
- term_type{‘terms’, ‘inclusions’, ‘exclusions’}
- Which type of terms to use. 
 
 
 - drop_term(label)[source]¶
- Drop specified term(s) from the object. - Parameters:
- labelstr or int or list
- The label of the term to drop. If str, is the label of the term. If int, is used as the index of the term. If list, drops each element of the list. 
 
 
 - get_index(label)[source]¶
- Get the index for a specified search term. - Parameters:
- labelstr
- The label of the search term. 
 
- Returns:
- indint
- The index of the requested search term. 
 
- Raises:
- IndexError
- If the requested term label is not found. 
 
 
 - get_term(label)[source]¶
- Get a search term from the object. - Parameters:
- labelstr or int
- The requested term. If str, is the label of the term. If int, is used as the index of the term. 
 
- Returns:
- termTerm
- The full search term definition. 
 
 
 - property has_terms¶
- Indicator for if the object has terms. 
 - property labels¶
- The labels for each term. 
 - make_search_term(label)[source]¶
- Create the combined search term for a selected term. - Parameters:
- labelstr or int
- The requested term. If str, is the label of the term. If int, is used as the index of the term. 
 
 
 - property n_terms¶
- How many terms are included in the object. 
 - set_joiners(search=None, inclusions=None, exclusions=None)[source]¶
- Set joiners to use, specified for each term type. - Parameters:
- search, inclusions, exclusions{‘OR’, ‘AND’, ‘NOT’}
- Joiner to use to combine terms, for search, inclusions, and exclusions terms. 
 
 
 - unload_terms(term_type='terms', reset=True, verbose=True)[source]¶
- Completely unload terms from the object. - Examples - Unload added terms: - >>> base = Base() >>> base.add_terms(['frontal lobe', 'temporal lobe', 'parietal lobe', 'occipital lobe']) >>> base.unload_terms() Unloading terms. - Attributes:
- term_type{‘terms’, ‘inclusions’, ‘exclusions’, ‘labels’, ‘all’}
- Which type of terms to unload. 
- resetbool, optional, default: True
- Whether to reset in/exclusions to empty lists. 
- verbosebool, optional
- Whether to be verbose in printing out any changes. 
 
 
 
 
 
 
 
