SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2011.00373 · 2020

Causal Inference for Spatial Treatments

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2011.00373.json · badge: /api/ran/2011.00373.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
michaelpollmann/spatialtreat-example canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
cnt_in_cell_mat Ran
ran on a synthesized input
michaelpollmann/spatialtreat-example/02_cnn_train.py
code served (permissive licence) · get_code("403612995552feba")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (50, 50) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import numba

size_potential = 10
size_padding = 20

@numba.jit(nopython=True)
def cnt_in_cell_mat(x, y):
    out = np.zeros((2 * size_padding + size_potential, 2 * size_padding + size_potential))
    for i in range(len(x)):
        if min(x[i], y[i]) >= 0 and max(x[i], y[i]) < 2 * size_padding + size_potential:
            out[y[i], x[i]] += 1
    return out

# Create valid arguments
# x and y are expected to be 1D arrays of indices
# Valid indices should be within [0, 2*size_padding + size_potential) = [0, 50)
x = np.array([5, 15, 25, 35], dtype=np.int64)
y = np.array([10, 20, 30, 40], dtype=np.int64)

ARGS = {
    "x": x,
    "y": y
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (50, 50) — shape (50, 50) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
data_shift_rotate Ran
ran on a synthesized input
michaelpollmann/spatialtreat-example/02_cnn_train.py
code served (permissive licence) · get_code("26facd813247c638")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from math import sin, cos, pi

torch.manual_seed(0)

# Create a small 2D point cloud matrix (N x 2)
# The function expects mat[:, 0] and mat[:, 1] to be accessible
mat = np.array([
    [1.0, 2.0],
    [3.0, 4.0]
], dtype=np.float64)

ARGS = {
    'mat': mat,
    'shift_x': 0.5,
    'shift_y': 1.0,
    'theta': 45.0,
    'mirror_var': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
data_to_grid Ran
ran on a synthesized input
michaelpollmann/spatialtreat-example/02_cnn_train.py
code served (permissive licence) · get_code("0977b7901ea38eb9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (50, 50) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from math import sin, cos, pi
import numba

cell_width = 0.025 * 1.609344 * 1000

size_potential = 10

size_padding = 20

@numba.jit(nopython=True)
def cnt_in_cell_mat(x, y):
    out = np.zeros((2 * size_padding + size_potential, 2 * size_padding + size_potential))
    for i in range(len(x)):
        if min(x[i], y[i]) >= 0 and max(x[i], y[i]) < 2 * size_padding + size_potential:
            out[y[i], x[i]] += 1
    return out

@numba.jit(nopython=True)
def data_shift_rotate(mat, shift_x=0, shift_y=0, theta=0, mirror_var=1):
    theta = theta * pi / 180
    if not theta == 0:
        x = cos(theta) * mat[:, 0] - sin(theta) * mat[:, 1]
        y = sin(theta) * mat[:, 0] + cos(theta) * mat[:, 1]
    else:
        x = mat[:, 0]
        y = mat[:, 1]
    if mirror_var == 1 or mirror_var == -1:
        x = mirror_var * x
    x = x + shift_x
    y = y + shift_y
    return (x, y)

def data_to_grid(mat, shift_x=0, shift_y=0, theta=0, mirror_var=1):
    x, y = data_shift_rotate(mat, shift_x, shift_y, theta, mirror_var)
    x = np.around(x / cell_width + size_padding).astype(int)
    y = np.around(y / cell_width + size_padding).astype(int)
    return cnt_in_cell_mat(x, y)

# Create a small test matrix with 2D coordinate data
# mat should be a 2D numpy array where each row is [x, y] coordinates
mat = np.array([
    [0.5, 0.3],
    [1.2, 1.5],
    [0.8, 0.9],
    [1.1, 0.4]
], dtype=np.float64)

ARGS = {
    "mat": mat,
    "shift_x": 0,
    "shift_y": 0,
    "theta": 0,
    "mirror_var": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (50, 50) — shape (50, 50) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
distance Ran
ran on a synthesized input
michaelpollmann/spatialtreat-example/distance.py
code served (permissive licence) · get_code("69c9f840693a2c0d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from math import radians, cos, sin, asin, sqrt

ARGS = {
    "lon1": -74.0060,
    "lat1": 40.7128,
    "lon2": -118.2437,
    "lat2": 34.0522,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
distance_vec Ran
ran on a synthesized input
michaelpollmann/spatialtreat-example/distance.py
code served (permissive licence) · get_code("d245c0ea28b9910d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import numba

@numba.jit
def distance_vec(lon1, lat1, lon2, lat2):
    """
    Calculate the great circle distance between two points 
    on the earth (specified in decimal degrees)
    """
    lon1 = np.deg2rad(lon1)
    lat1 = np.deg2rad(lat1)
    lon2 = np.deg2rad(lon2)
    lat2 = np.deg2rad(lat2)
    dlon = np.subtract(lon2, lon1)
    dlat = np.subtract(lat2, lat1)
    a = np.add(np.power(np.sin(np.divide(dlat, 2)), 2), np.multiply(np.cos(lat1), np.multiply(np.cos(lat2), np.power(np.sin(np.divide(dlon, 2)), 2))))
    c = np.multiply(2, np.arcsin(np.sqrt(a)))
    r = 6378137
    return c * r

# Construct arguments for distance_vec
# The function takes 4 parameters representing coordinates in decimal degrees
# lon1, lat1 = first point longitude and latitude
# lon2, lat2 = second point longitude and latitude

lon1 = np.array([-74.0060, -118.2437])  # New York, Los Angeles longitudes
lat1 = np.array([40.7128, 34.0522])     # New York, Los Angeles latitudes
lon2 = np.array([-0.1278, 139.6917])    # London, Tokyo longitudes
lat2 = np.array([51.5074, 35.6895])     # London, Tokyo latitudes

ARGS = {
    "lon1": lon1,
    "lat1": lat1,
    "lon2": lon2,
    "lat2": lat2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
filter_D Ran
ran on a synthesized input
michaelpollmann/spatialtreat-example/dist_between_vectors.py
code served (permissive licence) · get_code("43085c2b0f913331")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (4, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import math

# Create small numpy arrays for ids1 and ids2
ids1 = np.array([10, 20, 30, 40])
ids2 = np.array([100, 200, 300, 400])

# Create a distance array D with some values
# Some will be <= maxD and some will be > maxD
D = np.array([1.5, 3.0, 2.0, 5.0])

# Calculate the default maxD value
maxD = 2.5 / 0.62137119223733 * math.sqrt(2) * 1000

ARGS = {
    "ids1": ids1,
    "ids2": ids2,
    "D": D,
    "maxD": maxD
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 3) — shape (4, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Many events and policies (treatments) occur at specific spatial locations, with researchers interested in their effects on nearby units. I approach the spatial treatment setting from an experimental perspective: What ideal experiment would we design to estimate the causal effects of spatial treatments? This perspective motivates a comparison between units near realized treatment locations and units near counterfactual (unrealized) candidate locations, which differs from current empirical practice. I derive design-based standard errors that are straightforward to compute. For observational data, I propose machine learning methods to find counterfactual candidate locations when observable characteristics, rather than potential outcomes, determine treatment probabilities. To accommodate methods for high-dimensional data in the theory, I extend a double machine learning result to the design-based framework with spatial correlations. I apply the proposed methods to study the causal effects of grocery stores on foot traffic to nearby businesses during COVID-19 shelter-in-place policies, finding a large positive effect at very short distances, with no effect at larger distances.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2011.00373")
get_code_for_paper("2011.00373")
have("2011.00373")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2011.00373.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2011.00373.svg)](https://syntology.ai/paper/2011.00373)

Connect an agent — have() is free.