june.groups.school.Schools¶
-
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