june.groups.school

exception june.groups.school.SchoolError
__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
class june.groups.school.School(coordinates: Tuple[float, float] = None, n_pupils_max: int = None, age_min: int = 0, age_max: int = 18, sector: str = None, area: june.geography.geography.Area = None, n_classrooms: Optional[int] = None, years: Optional[int] = None)

Create a School given its description.

coordinates:

latitude and longitude

n_pupils_max:

maximum number of pupils that can attend the school

age_min:

minimum age of the pupils

age_max:

maximum age of the pupils

sector:

whether it is a “primary”, “secondary” or both “primary_secondary”

area:

area the school belongs to

n_classrooms:

number of classrooms in the school

years:

age group year per classroom

number of SubGroups N = age_max-age_min year +1 (student years) + 1 (teachers): 0 - teachers 1 - year of lowest age (age_min) … n - year of highest age (age_max)

class SubgroupType(value)

An enumeration.

students = 1
teachers = 0
__init__(coordinates: Tuple[float, float] = None, n_pupils_max: int = None, age_min: int = 0, age_max: int = 18, sector: str = None, area: june.geography.geography.Area = None, n_classrooms: Optional[int] = None, years: Optional[int] = None)

Create a School given its description.

coordinates:

latitude and longitude

n_pupils_max:

maximum number of pupils that can attend the school

age_min:

minimum age of the pupils

age_max:

maximum age of the pupils

sector:

whether it is a “primary”, “secondary” or both “primary_secondary”

area:

area the school belongs to

n_classrooms:

number of classrooms in the school

years:

age group year per classroom

number of SubGroups N = age_max-age_min year +1 (student years) + 1 (teachers): 0 - teachers 1 - year of lowest age (age_min) … n - year of highest age (age_max)

_collate_from_subgroups(attribute: str) → List[june.demography.person.Person]

Return a set of all of the people in the subgroups with a particular health status

attribute

The name of the attribute in the subgroup, e.g. “in_hospital”

The union of all the sets with the given attribute name in all of the sub groups.

classmethod _next_id() → int

Iterate an id for this class. Each group class has its own id iterator starting at 0

add(person, subgroup_type=<SubgroupType.students: 1>)

Add a person to a given subgroup. For example, in a school a student is added to the subgroup matching their age.

person

A person

group_type

clear()
get_spec() → str

Returns the speciailization of the group.

limit_classroom_sizes(max_classroom_size: int)

Make all subgroups smaller than `max_classroom_size`

max_classroom_size:

maximum number of students per classroom (subgroup)

remove_person(person: june.demography.person.Person)

Remove a person from this group by removing them from the subgroup to which they belong

person

A person

_abc_impl = <_abc_data object>
age_max
age_min
age_structure
property contains_people

Does this group contain at least one person?

coordinates
property dead
external = False
id
property in_hospital
property infected
property is_full
property must_timestep
property n_pupils
n_pupils_max
property n_teachers
n_teachers_max
property name

The name is computed on the fly to reduce memory footprint. It combines the name fo the class with the id of the instance.

property people

All the people in this group

property recovered
sector
property size
property size_infected
property size_recovered
property size_susceptible
spec
property students
subgroups
property super_area
property susceptible
property teachers
years
class june.groups.school.Schools(schools: List[School], school_trees: Optional[Dict[int, sklearn.neighbors._ball_tree.BallTree]] = None, agegroup_to_global_indices: dict = None)

Create a group of Schools, and provide functionality to access closest school

area_names

list of areas for which to build schools

schools:

list of school instances

school_tree:

BallTree built on all schools coordinates

agegroup_to_global_indices:

dictionary to map the

__init__(schools: List[School], school_trees: Optional[Dict[int, sklearn.neighbors._ball_tree.BallTree]] = None, agegroup_to_global_indices: dict = None)

Create a group of Schools, and provide functionality to access closest school

area_names

list of areas for which to build schools

schools:

list of school instances

school_tree:

BallTree built on all schools coordinates

agegroup_to_global_indices:

dictionary to map the

static _create_school_tree(schools_coordinates: numpy.ndarray) → sklearn.neighbors._ball_tree.BallTree

Reads school location and sizes, it initializes a KD tree on a sphere, to query the closest schools to a given location.

school_df:

dataframe with school characteristics data

Tree to query nearby schools

_make_member_ids_dict(members)

Makes a dictionary with the ids of the members.

add(group)
classmethod build_schools_for_areas(areas: june.geography.geography.Areas, school_df: pandas.core.frame.DataFrame, age_range: Tuple[int, int] = 0, 19, employee_per_clients: Dict[str, int] = None)june.groups.school.Schools

area Returns ——-

An infrastructure of schools

clear()
classmethod for_areas(areas: june.geography.geography.Areas, data_file: str = PosixPath('/home/sadie/JUNE/data/input/schools/england_schools.csv'), config_file: str = PosixPath('/home/sadie/JUNE/configs/defaults/groups/schools.yaml'))june.groups.school.Schools
area_names

list of areas for which to create populations

data_path

The path to the data directory

config

classmethod for_box_mode()
classmethod for_geography(geography: june.geography.geography.Geography, data_file: str = PosixPath('/home/sadie/JUNE/data/input/schools/england_schools.csv'), config_file: str = PosixPath('/home/sadie/JUNE/configs/defaults/groups/schools.yaml'))june.groups.school.Schools
geography

an instance of the geography class

classmethod from_file(areas: june.geography.geography.Areas, data_file: str = PosixPath('/home/sadie/JUNE/data/input/schools/england_schools.csv'), config_file: str = PosixPath('/home/sadie/JUNE/configs/defaults/groups/schools.yaml'))june.groups.school.Schools

Initialize Schools from path to data frame, and path to config file

filename:

path to school dataframe

config_filename:

path to school config dictionary

Schools instance

get_closest_schools(age: int, coordinates: Tuple[float, float], k: int) → int

Get the k-th closest school to a given coordinate, that accepts pupils aged age

age:

age of the pupil

coordinates:

latitude and longitude

k:

k-th neighbour

ID of the k-th closest school, within school trees for a given age group

get_from_id(id)
get_spec() → str

Returns the speciailization of the super group.

static init_trees(school_df: pandas.core.frame.DataFrame, age_range: Tuple[int, int])june.groups.school.Schools

Create trees to easily find the closest school that accepts a pupil given their age

school_df:

dataframe with school characteristics data

property group_spec
property member_ids