Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

confusing error message for map_to_aois #1045

Open
xiaotiansu opened this issue Mar 14, 2025 · 8 comments
Open

confusing error message for map_to_aois #1045

xiaotiansu opened this issue Mar 14, 2025 · 8 comments

Comments

@xiaotiansu
Copy link
Contributor

Question

I got an error message that I don't understand when applying map_to_aois

Sample Code

the GazeDataFrame
Image

the text stimulus
Image

the error message

Image
@SiQube
Copy link
Member

SiQube commented Mar 14, 2025

can you provide me with the IA.ias file and the first gaze file as well as your setup s.t. I can debug locally? if so you can send them by mail to me

@SiQube
Copy link
Member

SiQube commented Mar 14, 2025

the error message seems to indicate that you did not specify the pixel columns? maybe you can add

pixel_columns = [YOURNAMEFORXPIXELS, YOURNAMEFORYPIXELS]

then it could work

@xiaotiansu
Copy link
Contributor Author

the error message seems to indicate that you did not specify the pixel columns? maybe you can add

pixel_columns = [YOURNAMEFORXPIXELS, YOURNAMEFORYPIXELS]
then it could work

I defined that in the dataset definition, but sent you a github invite

@xiaotiansu
Copy link
Contributor Author

@SiQube Hi, I want to check the status of this issue. I got the following error message when I try to apply ia1 to events. I think that's because my ia1 doesn't have the required columns?

We configured IA using data viewer, it has left, right, top and bottom as shown in fig2. Could you provide some suggestions on how I could convert them to the requirement columns of start_x_column, start_y_column,

Image etc. in TextStimulus? Thanks!

Image

@SiQube
Copy link
Member

SiQube commented Mar 26, 2025

how did you load ia1 could you show this definition?

it should be a text stimulus, so it should roughly be:

ia1 = text.from_file(
    aoi_path=PATHTOYOURFILE,
    aoi_column='label',
    start_x_column='left',
    start_y_column='top',
    end_x_column='right',
    end_y_column='bottom',
)

@xiaotiansu
Copy link
Contributor Author

how did you load ia1 could you show this definition?

it should be a text stimulus, so it should roughly be:

ia1 = text.from_file(
aoi_path=PATHTOYOURFILE,
aoi_column='label',
start_x_column='left',
start_y_column='top',
end_x_column='right',
end_y_column='bottom',
)

I loaded them fron .ias file

ia1 = pd.read_csv("../IA/C1_IA.ias", sep="\s+", header=2)

@SiQube
Copy link
Member

SiQube commented Mar 26, 2025

please use the TextStimulus class and the loading process shown above

@xiaotiansu
Copy link
Contributor Author

xiaotiansu commented Mar 26, 2025

please use the TextStimulus class and the loading process shown above

Thanks! Now I loaded successfully. But got a columnnotfound error

Image


ColumnNotFoundError Traceback (most recent call last)
/var/folders/9h/zxy2rjy11gl458q0zy5_k1sw0000gn/T/ipykernel_43249/1456637521.py in ?()
----> 1 dataset.events[0].map_to_aois(ia1)

/opt/homebrew/lib/python3.11/site-packages/pymovements/events/frame.py in ?(self, aoi_dataframe)
323 Text dataframe to map fixation to.
324 """
325 self.unnest()
326 self.frame = self.frame.with_columns(
--> 327 area_of_interest=pl.Series(
328 get_aoi(
329 aoi_dataframe, row, 'location_x', 'location_y',
330 )

/opt/homebrew/lib/python3.11/site-packages/polars/series/series.py in ?(self, name, values, dtype, strict, nan_to_null)
329 ):
330 self._s = pandas_to_pyseries(name, values, dtype=dtype, strict=strict)
331
332 elif not hasattr(values, "arrow_c_stream") and _is_generator(values):
--> 333 self._s = iterable_to_pyseries(name, values, dtype=dtype, strict=strict)
334
335 elif isinstance(values, Series):
336 self._s = series_to_pyseries(

/opt/homebrew/lib/python3.11/site-packages/polars/_utils/construction/series.py in ?(name, values, dtype, chunk_size, strict)
355
356 n_chunks = 0
357 series: Series = None # type: ignore[assignment]
358 while True:
--> 359 slice_values = list(islice(values, chunk_size))
360 if not slice_values:
361 break
362 schunk = to_series_chunk(slice_values, dtype)

/opt/homebrew/lib/python3.11/site-packages/pymovements/events/frame.py in ?(.0)
327 def map_to_aois(self, aoi_dataframe: TextStimulus) -> None:
--> 328 """Map events to aois.
329
330 Parameters
331 ----------

/opt/homebrew/lib/python3.11/site-packages/pymovements/utils/aois.py in ?(aoi_dataframe, row, x_eye, y_eye)
96 (aoi_dataframe.aois[aoi_dataframe.start_y_column] <= row[y_eye]) &
97 (row[y_eye] < aoi_dataframe.aois[aoi_dataframe.end_y_column]),
98 )[aoi_dataframe.aoi_column].item()
99 return aoi
--> 100 except ValueError:
101 return ''
102 else:
103 raise ValueError(

/opt/homebrew/lib/python3.11/site-packages/polars/dataframe/frame.py in ?(self, key)
1358 │ 2 ┆ 5 ┆ 3 │
1359 │ 3 ┆ 6 ┆ 2 │
1360 └─────┴─────┴─────┘
1361 """
-> 1362 return get_df_item_by_key(self, key)

/opt/homebrew/lib/python3.11/site-packages/polars/_utils/getitem.py in ?(df, key)
159 # Single string input, e.g. df["a"]
160 if isinstance(key, str):
161 # This case is required because empty strings are otherwise treated
162 # as an empty Sequence in _select_rows
--> 163 return df.get_column(key)
164
165 # Single input - df[1] - or multiple inputs - df["a", "b", "c"]
166 try:

/opt/homebrew/lib/python3.11/site-packages/polars/dataframe/frame.py in ?(self, name, default)
8522 try:
8523 return wrap_s(self._df.get_column(name))
8524 except ColumnNotFoundError:
8525 if default is no_default:
-> 8526 raise
8527 return default

ColumnNotFoundError: "left" not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants