AOI
Add Srcml to AOIs
def add_srcml_to_AOIs(
aois_raw: pandas.core.frame.DataFrame,
srcML_path: str
)->pd.dataframe:
Add srcML tags to AOIs dataframe and returns it. Check https://www.srcml.org/ for more information about srcML The files: rectangle.tsv and vehicle.tsv should be in the same directory as the code.
Parameters
- aois_raw : pandas.Dataframe the dataframe where AOIs are stored
- srcML_path : string the path of the srcML tags file
Returns
pandas.DataFrame: AOI dataframe with srcML
Add Tokens to AOIs
def add_tokens_to_AOIs(
file_path:str
aois_raw: pandas.core.frame.DataFrame str
)->pd.dataframe:
Adds tokens from code files to aois dataframe and returns it.
Parameters
- file_path : str path to directory where code files are stored. In EMIP this is "emip_stimulus_programs"
- aois_raw : pandas.Dataframe the dataframe where AOIs are stored.
Returns
pandas.DataFrame: a dataframe of AOIs with token information
Find AOI
def find_aoi(
eye_events: pd.Dataframe=pd.Dataframe(),
eye_tracker_col: str = "eye_tracker",
stimuli_module_col: str = "stimuli_module",
stimuli_name_col: str = "stimuli_name", image: Image = None
level: str = "sub_line", margin_height: int = 4, margin_width: int = 7
)->pd.Dataframe:
Adds tokens from code files to aois dataframe and returns it.
Parameters
- eye_events : pandas.DataFrame, optional (default pandas.DataFrame()) A pandas dataframe of eye events. It must contains columns that specify the name of the eye tracker, stimuli module, and name of stimuli. If this dataframe is empty, image must be specified.
- eye_tracker_col : str, optional (default "eye_tracker") Name of the column in eye_events dataframe that contains the name of the eye tracker.
- stimuli_module_col : str, optional (default "stimuli_module") Name of the column in eye_events dataframe that contains the path to the stimuli module.
- sstimuli_name_col : str, optional (default "stimuli_name") Name of the column in eye_events dataframe that contains the name of the stimuli.
- image : PIL.Image, optional (default None) Stimuli image. If this is empty, eye_events must be specified.
- level : str, optional (default "sub-line") Level of detection in AOIs. "Line" for each line as an AOI or "sub-line" for each token as an AOI.
- margin_height : int, optional (default 4) Marginal height when finding AOIs, use smaller number for tight text layout.
- margin_width : int, optional (default 7) Marginal width when finding AOIs, use smaller number for tight text layout.
Returns
pandas.DataFrame: a pandas DataFrame of area of interest detected by the method