Overall - Snailz Docs

Skip to content

# Overall

Represent snailz parameters.

## `AllParams`

Bases: `BaseModel`

Represent all parameters combined.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`seed` | `int` | RNG seed | `7493418`
`assay` | `AssayParams` | parameters for assay generation | `AssayParams(baseline=2.0, degrade=0.05, delay=5, mutant=5.0, noise=0.2, plate_size=4, image_noise=32)`
`survey` | `SurveyParams` | parameters for survey generation | `SurveyParams(number=3, size=15, start_date=datetime.date(2024, 3, 1), max_interval=7)`
`person` | `PersonParams` | parameters for people generation | `PersonParams(locale='et_EE', number=5)`
`specimen` | `SpecimenParams` | parameters for specimen generation | `SpecimenParams(length=20, max_mass=10.0, mut_mass_scale=2.0, num_mutations=5, spacing=3.75, p_missing_location=0.05)`

Source code in `src/snailz/overall.py`

    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    class AllParams(BaseModel):
        """Represent all parameters combined."""

        seed: int = Field(default=7493418, ge=0, description="RNG seed")
        assay: AssayParams = Field(
            default=AssayParams(), description="parameters for assay generation"
        )
        survey: SurveyParams = Field(
            default=SurveyParams(), description="parameters for survey generation"
        )
        person: PersonParams = Field(
            default=PersonParams(), description="parameters for people generation"
        )
        specimen: SpecimenParams = Field(
            default=SpecimenParams(), description="parameters for specimen generation"
        )

        model_config = {"extra": "forbid"}

## `AllData`

Bases: `BaseModel`

Represent all generated data combined.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`params` | `AllParams` | all parameters | required
`assays` | `AllAssays` | all assays | required
`surveys` | `AllSurveys` | all surveys | required
`persons` | `AllPersons` | all persons | required
`specimens` | `AllSpecimens` | all specimens | required

Source code in `src/snailz/overall.py`

    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    class AllData(BaseModel):
        """Represent all generated data combined."""

        params: AllParams = Field(description="all parameters")
        assays: AllAssays = Field(description="all assays")
        surveys: AllSurveys = Field(description="all surveys")
        persons: AllPersons = Field(description="all persons")
        specimens: AllSpecimens = Field(description="all specimens")

        model_config = {"extra": "forbid"}

## `all_generate(params)`

Generate and save all data.

Source code in `src/snailz/overall.py`

    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    def all_generate(params: AllParams) -> AllData:
        """Generate and save all data."""
        surveys = surveys_generate(params.survey)
        persons = persons_generate(params.person)
        specimens = specimens_generate(params.specimen, surveys)
        assays = assays_generate(params.assay, persons, specimens)
        return AllData(
            assays=assays,
            params=params,
            persons=persons,
            specimens=specimens,
            surveys=surveys,
        )