nalmadi / EMIP-Toolkit

EMIP Toolkit (EMTK): A Python Library for Processing Eye Movement in Programming Data
18 stars 22 forks source link

Enhancement - Save image background size as a field of Experiment class #27

Closed quanphan2906 closed 2 years ago

quanphan2906 commented 3 years ago

In draw_trial method of Trial class: https://github.com/nalmadi/EMIP-Toolkit/blob/bac781b17e718207e4c39e900c55ba584fdf3d40/emip_toolkit.py#L593-L674

With the background-size: https://github.com/nalmadi/EMIP-Toolkit/blob/bac781b17e718207e4c39e900c55ba584fdf3d40/emip_toolkit.py#L624 and trial location: https://github.com/nalmadi/EMIP-Toolkit/blob/bac781b17e718207e4c39e900c55ba584fdf3d40/emip_toolkit.py#L629

I suggest saving them as fields of the Experiment class instead of declaring them arbitrarily without any context because the coordinates of the Fixations depend on the background-size and the trial location.

nalmadi commented 3 years ago

Good suggestion, thank you!

Is it better to store the image dimensions in as a field in Trial instead of experiment?

I think Trial is where the image path is stored, so the background size could be stored there as well. Do you agree?

jhimel22 commented 2 years ago

if self.eye_tracker == "EyeLink1000":

        background_size = (1024, 768)
        Experiment.bgsize = background_size
        background = Image.new('RGB', background_size, color= color)

        *_, width, _ = im.getbbox()

Parameter was also added to Experiment class, though since the class doesn't acquire that info internally it is defaulted to zero until assigned.

nalmadi commented 2 years ago

Thanks @jhimel22

If you tested this let's create a pull request for this

jhimel22 commented 2 years ago

I have tested it on a standalone redesign of the toolkit but due to my lack of access to the dataset intended for the notebook I couldn't confirm officially. Is there another place I can access the dataset?

nalmadi commented 2 years ago

@jhimel22, you can check the existing Jupyter notebook in the repo, you should find the following line in it: data_path = tk.download('EMIP')

This line downloads the EMIP dataset to your computer and allows you to use it in the code with data_path. Let me know if you have any questions!

quanphan2906 commented 2 years ago

With the new design, this question is no longer relevant. I am closing this issue.