june.groups.leisure.pub

class june.groups.leisure.pub.Pub

A group of people such as in a hospital or a school.

If a spec attribute is not defined in the child class then it is generated by converting the class name into snakecase.

class SubgroupType(value)

An enumeration.

default = 0
__init__()

A group of people such as in a hospital or a school.

If a spec attribute is not defined in the child class then it is generated by converting the class name into snakecase.

_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, activity='leisure')

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.

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>
property contains_people

Does this group contain at least one person?

property dead
external = False
id
property in_hospital
property infected
max_size = 100
property must_timestep
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
property size
property size_infected
property size_recovered
property size_susceptible
spec
subgroups
property super_area
property susceptible
class june.groups.leisure.pub.PubDistributor(social_venues: june.groups.leisure.social_venue.SocialVenues, male_age_probabilities: dict = None, female_age_probabilities: dict = None, drags_household_probability=0.5, neighbours_to_consider=5, maximum_distance=5, weekend_boost: float = 1.0)

A sex/age profile for the social venue attendees can be specified as male_age_probabilities = {“18-65” : 0.3} any non-specified ages in the range (0,99) will have 0 probabilty Parameters ———- social_venues

A SocialVenues object

male_age_probabilities

a dictionary containg age as keys and the probabilty per day (think of it as the Poisson parameter lambda) of a male person of that age going to the social venue as value. This probability value is per day. So the chance of going to the social venue in a time delta_t is 1 - exp(- probabilty * delta_t)

female_age_probabilities

a dictionary containg age as keys and the probabilty of a female person of that age going to the social venue as value

weekend_boost

boosting factor for the weekend probability

__init__(social_venues: june.groups.leisure.social_venue.SocialVenues, male_age_probabilities: dict = None, female_age_probabilities: dict = None, drags_household_probability=0.5, neighbours_to_consider=5, maximum_distance=5, weekend_boost: float = 1.0)

A sex/age profile for the social venue attendees can be specified as male_age_probabilities = {“18-65” : 0.3} any non-specified ages in the range (0,99) will have 0 probabilty Parameters ———- social_venues

A SocialVenues object

male_age_probabilities

a dictionary containg age as keys and the probabilty per day (think of it as the Poisson parameter lambda) of a male person of that age going to the social venue as value. This probability value is per day. So the chance of going to the social venue in a time delta_t is 1 - exp(- probabilty * delta_t)

female_age_probabilities

a dictionary containg age as keys and the probabilty of a female person of that age going to the social venue as value

weekend_boost

boosting factor for the weekend probability

classmethod from_config(social_venues: june.groups.leisure.social_venue.SocialVenues, config_filename: str = None)
get_leisure_subgroup_type(person)
get_poisson_parameter(sex, age, is_weekend: bool = False)

Poisson parameter (lambda) of a person going to one social venue according to their age and sex and the distribution of visitors in the venue.

person

an instance of Person

delta_t

interval of time in units of days

is_weekend

whether it is a weekend or not

get_possible_venues_for_area(area: june.geography.geography.Area)

Given an area, searches for the social venues inside self.maximum_distance. It then returns self.neighbours_to_consider of them randomly. If there are no social venues inside the maximum distance, it returns the closest one.

get_possible_venues_for_household(household: june.groups.household.Household)

Given a household location, searches for the social venues inside self.maximum_distance. It then returns self.neighbours_to_consider of them randomly. If there are no social venues inside the maximum distance, it returns the closest one.

get_social_venue_for_person(person)

Adds a person to one of the social venues in the distributor. To decide, we select randomly from a certain number of neighbours, or the closest venue if the distance is greater than the maximum_distance.

person

person_drags_household()

Check whether person drags household or not.

probability_to_go_to_social_venue(person, delta_time, is_weekend: bool = False)

Probabilty of a person going to one social venue according to their age and sex and the distribution of visitors in the venue.

person

an instance of Person

delta_t

interval of time in units of days

is_weekend

whether it is a weekend or not

default_config_filename = PosixPath('/home/sadie/JUNE/configs/defaults/groups/leisure/pubs.yaml')
class june.groups.leisure.pub.Pubs(social_venues: List[june.groups.leisure.social_venue.SocialVenue], make_tree=True)
social_venue_class

alias of Pub

__init__(social_venues: List[june.groups.leisure.social_venue.SocialVenue], make_tree=True)

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

_make_member_ids_dict(members)

Makes a dictionary with the ids of the members.

add(group)
add_to_areas(areas: june.geography.geography.Areas)

Adds all venues to the closest super area

clear()
classmethod distribute_for_areas(areas: List[june.geography.geography.Area], venues_per_capita: float = None, venues_per_area: int = None)

Generates social venues in the given areas.

areas

list of areas to generate the venues in

venues_per_capita

number of venues per person in each area.

venues_per_area

number of venues in each area.

classmethod distribute_for_super_areas(super_areas: List[june.geography.geography.SuperArea], venues_per_super_area=1, venues_per_capita=1)

Generates social venues in the given super areas.

super_areas

list of areas to generate the venues in

venues_per_super_area

how many venus per super_area to generate

classmethod for_areas(areas: june.geography.geography.Areas, coordinates_filename: str = None)
classmethod for_box_mode()
classmethod for_geography(geography: june.geography.geography.Geography, coordinates_filename: str = None)
classmethod for_super_areas(super_areas: List[june.geography.geography.SuperArea], coordinates_filename: str = None)
classmethod from_coordinates(coordinates: List[numpy.array], super_areas: Optional[june.geography.geography.Areas], max_distance_to_area=5, **kwargs)
classmethod from_file()
get_closest_venues(coordinates, k=1)

Queries the ball tree for the closests venues.

coordinates

coordinates in the format [Latitude, Longitude]

k

number of neighbours desired

get_from_id(id)
get_spec() → str

Returns the speciailization of the super group.

get_venues_in_radius(coordinates, radius=5)

Queries the ball tree for the closests venues.

coordinates

coordinates in the format [Latitude, Longitude]

radius

radius in km to query

make_tree()
default_coordinates_filename = PosixPath('/home/sadie/JUNE/data/input/leisure/pubs_per_super_area.csv')
property group_spec
property member_ids