iblrig.pydantic_definitions.TrialDataModel
- class iblrig.pydantic_definitions.TrialDataModel[source]
A data model for trial data that extends BaseModel.
This model allows for the addition of extra fields beyond those defined in the model.
- classmethod preallocate_dataframe(n_rows)[source]
Preallocate a DataFrame with specified number of rows, using default values or pandas.NA.
This method creates a pandas DataFrame with the same columns as the fields defined in the Pydantic model. Each column is initialized with the field’s default value if available, otherwise with pandas.NA.
We use Pandas.NA for default values rather than NaN, None or Zero. This allows us to clearly indicate missing values - which will raise a Pydantic ValidationError.
- model_config: ClassVar[ConfigDict] = {'extra': 'allow'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].