{"id":38946454,"url":"https://github.com/jgregoriods/expand","last_synced_at":"2026-01-17T16:01:58.290Z","repository":{"id":37681975,"uuid":"255580715","full_name":"jgregoriods/expand","owner":"jgregoriods","description":"Agent-based model of demic expansions in South America during the late Holocene.","archived":false,"fork":false,"pushed_at":"2022-12-08T11:45:07.000Z","size":31301,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-05T15:21:07.216Z","etag":null,"topics":["agent-based-modeling","archaeology","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgregoriods.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-14T10:39:10.000Z","updated_at":"2022-08-14T18:23:47.000Z","dependencies_parsed_at":"2023-01-25T13:00:07.088Z","dependency_job_id":null,"html_url":"https://github.com/jgregoriods/expand","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/jgregoriods/expand","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgregoriods%2Fexpand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgregoriods%2Fexpand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgregoriods%2Fexpand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgregoriods%2Fexpand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgregoriods","download_url":"https://codeload.github.com/jgregoriods/expand/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgregoriods%2Fexpand/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-based-modeling","archaeology","simulation"],"created_at":"2026-01-17T16:01:58.226Z","updated_at":"2026-01-17T16:01:58.276Z","avatar_url":"https://github.com/jgregoriods.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExPaND\n\u003ch2\u003eSimulating demic expansion of farmers in tropical South America\u003c/h2\u003e\n\nJonas Gregorio de Souza\u003cbr/\u003e\n[![ORCiD](https://img.shields.io/badge/ORCiD-0000--0001--7879--4531-green.svg)](https://orcid.org/0000-0001-6032-4443)\u003cbr/\u003e\n\n\u003cp\u003eThis is an agent-based model for simulating the demic expansion of tropical forest farmers in late Holocene South America. Over the last 5000 years, archaeological cultures like the Saladoid-Barrancoid and Tupiguarani expanded over different parts of Amazon and beyond, spreading the practice of polyculture agroforestry. Can these archaeological expansions be modelled as demic waves of advance similar to what has been proposed for the Neolithic in Eurasia? Model results are assessed by comparing simulated arrival times with radiocarbon dates. Similar models, where human expansions are determined by population growth, fission and relocation, have been developed for the spread of farming in Europe (\u003ca href=\"https://doi.org/10.7183/0002-7316.77.2.203\"\u003eFort et al. 2012\u003c/a\u003e; \u003ca href=\"https://doi.org/10.1073/pnas.1613413114\"\u003eIsern et al. 2017\u003c/a\u003e). The same concept is adopted here, with the rules of the model informed by the ethnography of tropical forest farmers. For a complete description of the model, see Souza et al. (\u003ca href=\"https://doi.org/10.1371/journal.pone.0232367\"\u003e2020\u003c/a\u003e).\u003c/p\u003e\n\u003ch3\u003eInstallation\u003c/h3\u003e\n\u003cp\u003eClone or download the repository. There are some dependencies that need to be installed:\u003c/p\u003e\n\n```\npip3 install -r requirements.txt\n```\n\n\u003ch3\u003eModel architecture\u003c/h3\u003e\n\n\u003cp\u003eExpansions result from the interaction between population growth, village fission and village relocation. Each village has a territory within a \u003ci\u003ecatchment radius\u003c/i\u003e and a \u003ci\u003emaximum population density\u003c/i\u003e (\u003ci\u003eK*\u003c/i\u003e). The population grows at a rate of 2.5% per year. If the population is above the maximum density, more cells (10 x 10 km) are added to its territory. When the village population is above a certain \u003ci\u003ethreshold\u003c/i\u003e and there are free cells outside of its catchment, it fissions, giving birth to a new village. If a village has been in its location beyond a \u003ci\u003emaximum permanence time\u003c/i\u003e, it also looks for free cells outside its catchment to move. Finally, villages have the option to \u003ci\u003eleapfrog\u003c/i\u003e: if there are no free cells in the immediate neighbourhood, they can jump over longer distances.\u003c/p\u003e\n\u003cp\u003eThe model starts with a village whose population is at the fission threshold, so that it immediately fissions and starts the expansion.\u003c/p\u003e\n\u003cp\u003eWhen fissioning or moving, villages choose the best cell according to a suitability layer. Here, a layer env.asc is provided in the \u003ccode\u003e/layers\u003c/code\u003e folder for illustrative purposes. The layer was created using MaxEnt. In the code, a parameter \u003ccode\u003etolerance\u003c/code\u003e is passed to the agents, determining the minimum value for a cell to be settled. In this version, the value 0.3 was used, based on the max training sensitivity and specificity threshold of the MaxEnt results.\u003c/p\u003e\n\n\u003ch3\u003eRunning the model\u003c/h3\u003e\n\n\u003cp\u003eYou must define a start date (BP) and a dictionary with the parameters: the coordinates (lonlat) of the first village, the maximum population density (persons 100 km\u003csup\u003e-2\u003c/sup\u003e), fission threshold, catchment radius (km), leap distance (km) and maximum permanence time (years).\u003c/p\u003e\n\n\u003cp\u003eFor now, let's set the start date to 4600 BP and the initial coordinates to -65.77 7.82 (approximate coordinates of La Gruta, which potentially contains some of the earliest Saladoid-Barrancoid ceramics).\u003c/p\u003e\n\n```python\n\u003e\u003e\u003e from model import Model\n\n\u003e\u003e\u003e start_date = 4600\n\u003e\u003e\u003e params = {\n    'coords': (-65.77, 7.82),\n    'k': 30,\n    'fission_threshold': 70,\n    'catchment': 10,\n    'leap_distance': 150,\n    'permanence': 15,\n    'tolerance': 0.3\n}\n\u003e\u003e\u003e model = Model(start_date, params)\n\u003e\u003e\u003e model.run(4100, show_prog=True)\n100%|██████████████████████████████████████| 4100/4100 [00:08\u003c00:00, 507.48it/s]\n```\n\n\u003cp\u003eThe results of the model can be evaluated by comparing simulated arrival times with radiocarbon dates in different regions. The calibrated dates you want to use for comparison must be placed in the folder \u003ccode\u003e/dates\u003c/code\u003e. Files must be in .csv format with two columns, one for each date, with a first row containing XY coordinates for the dated site in lonlat format and the remaining rows containing years BP and the respective probability densities.\u003c/p\u003e\n\n\u003cp\u003eThe result is a score from 0 to 1 obtained by averaging the intercepted normalised probability at each dated site (or 0 if the simulated arrival time is outside of the calibrated distribution).\u003c/p\u003e\n\n```python\n\u003e\u003e\u003e score = model.eval()\n\u003e\u003e\u003e print('score:', round(score, 2))\nscore: 0.57\n```\n\n\u003cp\u003eYou can save the results to be used in other software. This creates two files in the \u003ccode\u003e/results\u003c/code\u003e folder: one starting with \u003ccode\u003esim...\u003c/code\u003e containing the simulated arrival times and the other starting with \u003ccode\u003edates...\u003c/code\u003e containing the intercepted probability densities.\u003c/p\u003e\n\n```python\n\u003e\u003e\u003e model.write()\n```\n\nYou can also run from the command line by using the following arguments:\n\n```\npython3 run.py --start=4600 --x=-65.77 --y=7.82 --k=30 --fiss=70 --catch=10 --leap=150 --perm=15 --tol=0.3 --iter=4100 --write --eval --show-bar\n```\n\n\u003cimg src='img/res.png' width='300' /\u003e\n\n\u003ch3\u003eReferences\u003c/h3\u003e\n\n\u003cp\u003eFort, Joaquim, Toni Pujol, and Marc Vander Linden. 2012. \u003ca href=\"https://doi.org/10.7183/0002-7316.77.2.203\"\u003e“Modelling the Neolithic Transition in the Near East and Europe.”\u003c/a\u003e American Antiquity 77 (2): 203–19.\u003c/p\u003e\n\u003cp\u003eIsern, Neus, João Zilhão, Joaquim Fort, and Albert J Ammerman. 2017. \u003ca href=\"https://doi.org/10.1073/pnas.1613413114\"\u003e“Modeling the Role of Voyaging in the Coastal Spread of the Early Neolithic in the West Mediterranean.”\u003c/a\u003e Proceedings of the National Academy of Sciences 114 (5): 897 LP – 902.\u003c/p\u003e\n\u003cp\u003eSouza, J.G., Alcaina-Mateos, J., Madella, M. 2020. \u003ca href=\"https://doi.org/10.1371/journal.pone.0232367\"\u003e\"Archaeological expansions in tropical South America during the late Holocene: Assessing the role of demic diffusion\"\u003c/a\u003e. PLOS ONE 15(4): e0232367.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgregoriods%2Fexpand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgregoriods%2Fexpand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgregoriods%2Fexpand/lists"}