emodpy_malaria.interventions.scale_larval_habitats module#

emodpy_malaria.interventions.scale_larval_habitats.add_scale_larval_habitats(campaign, df=None, start_day: int = 0, repetitions: int = 1, timesteps_between_repetitions: int = 365)[source]#

Reduce available larval habitat in a node-specific way.

Parameters:
  • campaign – campaign object to which the intervention will be added, and schema_path container

  • df

    The dataframe containing habitat scale factors. Examples:

    Scale TEMPORARY_RAINFALL by 3-fold for all nodes, all species:
    df = pd.DataFrame({ 'TEMPORARY_RAINFALL': [3]})
    
    Scale TEMPORARY_RAINFALL by 3-fold for all nodes, arabiensis only:
    df = pd.DataFrame({ 'TEMPORARY_RAINFALL.arabiensis': [3]})
    
    Scale differently by node ID:
    df = pd.DataFrame({ 'NodeID' : [0, 1, 2, 3, 4],
                        'CONSTANT': [1, 0, 1, 1, 1],
                        'TEMPORARY_RAINFALL': [1, 1, 0, 1, 0]})
    
    Scale differently by both node ID and species:
    df = pd.DataFrame({ 'NodeID' : [0, 1, 2, 3, 4],
                        'CONSTANT.arabiensis': [1, 0, 1, 1, 1],
                        'TEMPORARY_RAINFALL.arabiensis': [1, 1, 0, 1, 0],
                        'CONSTANT.funestus': [1, 0, 1, 1, 1]})
    
    Scale some habitats by species and others same for all species:
    df = pd.DataFrame({ 'NodeID' : [0, 1, 2, 3, 4],
                        'CONSTANT.arabiensis': [1, 0, 1, 1, 1],
                        'TEMPORARY_RAINFALL.arabiensis': [1, 1, 0, 1, 0],
                        'CONSTANT.funestus': [1, 0, 1, 1, 1],
                        'LINEAR_SPLINE': [1, 1, 0, 1, 0]})
    
    Scale nodes at different dates:
    df = pd.DataFrame({  'NodeID' : [0, 1, 2, 3, 4],
                         'CONSTANT': [1, 0, 1, 1, 1],
                         'TEMPORARY_RAINFALL': [1, 1, 0, 1, 0],
                         'Start_Day': [0, 30, 60, 65, 65]
                         })
    

  • start_day – The date that habitats are scaled for all scaling actions specified in df. Used only if there is no Start_Day column in df.

  • repetitions – The number of times to repeat the intervention.

  • timesteps_between_repetitions – The number of time steps between repetitions.

Returns:

None

emodpy_malaria.interventions.scale_larval_habitats.add_habitat_reduction_event(campaign, start_day: int, node_ids: list, habitat_scales: list, repetitions: int, timesteps_between_repetitions: int)[source]#

Add a campaign event to reduce vector’s larval habitat(s).

Parameters:
  • campaign – campaign object to which the intervention will be added, and schema_path container

  • start_day – The day the intervention is given out.

  • node_ids – List of nodes to which to distribute the intervention. [] or None, indicates all nodes will get the intervention

  • habitat_scales

    List of dictionaries for scaling larval habitats. Examples:

    [{"Habitat": "ALL_HABITATS", "Species": "ALL_SPECIES", "Factor": 0.5},
    {"Habitat": "CONSTANT", "Species": "arabiensis", "Factor": 2}]
    

  • repetitions – The number of times an intervention is given, used with timesteps_between_repetitions. -1 means the intervention repeats forever. Sets Number_Repetitions

  • timesteps_between_repetitions – The interval, in timesteps, between repetitions. Ignored if repetitions = 1. Sets Timesteps_Between_Repetitions

Returns:

Nothing