Data dictionary¶
What every array from fg.load() holds, as a record (order="random") or as a frame of the
timeline (order="time").
N = number of buses (nodes), E = number of branches (edges). A shape is "values per item":
[N,4] = 4 numbers per bus, [E,8] = an 8-dim vector per branch, [2,E] = 2 rows × E branches.
Cheat sheet¶
| field | shape | columns | meaning |
|---|---|---|---|
node_x |
[N,4] |
|V|, P_inj, Q_inj, theta |
bus meter readings |
node_m |
[N,4] |
same columns | 1 metered, 0 not (value zero-filled) |
edge_x |
[E,2] |
P_from, Q_from |
power leaving the branch (sign = direction) |
edge_m |
as edge_x |
same columns | 1 metered, 0 not |
edge_index |
[2,E] |
row 0 from_bus, row 1 to_bus |
connectivity |
edge_attr |
[E,8] |
r, x, b, g, gs, bs, tap, shift |
static branch electrical properties |
y |
[N] |
1 attacked, 0 clean. Which buses | |
family |
scalar | 0 benign, 1 Aq, 2 Ad, 3 As, 4 Ar, 5 At, 6 Al, 7 Am. Which attack | |
temporal_delta |
[N,2] |
ΔP, ΔQ |
injection change against the previous frame |
swing |
[N,2] |
ΔP, ΔQ |
temporal_delta as a z-score of recent volatility |
benign |
[N,4] |
same as node_x |
the same scan with the attack removed, noise kept (timelines) |
edge_benign |
[E,2] |
same as edge_x |
the same flows with the attack removed, noise kept (timelines) |
clean |
[N,4] |
same as node_x |
noiseless truth, all buses. The SE target (v0.7.2+) |
edge_clean |
[E,2] |
same as edge_x |
noiseless true flows, unmetered branches zeroed |
edge_clean_full |
[E,2] |
same as edge_x |
noiseless true flows on every branch, metered or not (computed from clean through yf on load; equals edge_clean where a flow meter exists) |
One layout. Every file the package writes has from-end flows [E,2], currents as real and imaginary parts, and both
temporal features. A file that declares another layout (attrs["edge_feat"] naming four flows, or
attrs["current_form"] other than rectangular) is refused with NotATimeline when it is opened. A file built from a pool with times carries
data/time (int64 seconds), and one built with the owners of its buses carries graph/bus_client with the
attribute client_names.
Layers and labels says more.
Labels: y says which buses, family says which attack¶
Two fields, two questions. y [N] is binary per bus because a bus is either tampered with or not.
family is one code per record because the generator runs one attack episode at a time, on one
or more buses at once; episodes never overlap, so each frame has one active family. That is a
property of how these files were built, not of the schema: concurrent attacks of different families would need a separate per-bus family map, say
bus_family [N] with 0 on clean buses (so y = bus_family > 0), added next to the scalar family
in a new data release.
| shape | values | in a batch | |
|---|---|---|---|
y |
[N] |
0 clean, 1 attacked | batch["y"] [B,N] (PyG: batch.y [B*N]) |
family |
scalar | 0 benign, 1 Aq, 2 Ad, 3 As, 4 Ar, 5 At, 6 Al, 7 Am (timelines only) | batch["family"] [B] (PyG: batch.family [B]) |
- Names:
fg.FAMILIES[code]. Stealthy subset:fg.STEALTHY_FAMILIES={1, 5, 6, 7}. - Per-bus family label, if a model needs one:
y * family[:, None]gives[B,N]with 0 on clean buses. - Every attacked record flags at least one bus. Benign records flag none.
- Per-family evaluation: filter by
familyand scoreyinside each group.fg.load(..., families=[...])does the filtering at load time.
node_x [N,4]: bus measurements (voltage first)¶
The column order is defined once, in fdia_graph.constants.channels.NodeChannel (V, P_INJ, Q_INJ,
THETA). A member is its column number, so it indexes a numpy array or a tensor directly, and the
generator, the loader and the estimator index columns through NodeChannel and EdgeChannel rather
than literals:
from fdia_graph.constants.channels import NodeChannel
rec = ds[0]
rec.node_x[..., NodeChannel.THETA] # the angle column, a view of rec.node_x[..., 3]
ds.export(["clean"]).clean[..., NodeChannel.V] # any [..., 4] array, a split's clean layer included
| col | name | physical units | pu units |
|---|---|---|---|
| 0 | |V| |
per-unit | per-unit |
| 1 | P_inj |
MW | pu |
| 2 | Q_inj |
MVAr | pu |
| 3 | theta |
degrees | radians |
Sign of P_inj/Q_inj: + = net consumption (load), − = net injection (gen). This is pandapower's
res_bus convention. Example (case14): the slack bus reads ≈ −235 MW, a 94 MW load bus reads ≈ +93 MW.
Every file the package's source writes has this sign, a New York file too: SearchSource.for_pool turns
the pool's injections to it.
edge_attr [E,8]: static branch properties (per-unit, never change)¶
| col | name | meaning |
|---|---|---|
| 0 | r |
series impedance, real part (resistance). Z = r + jx |
| 1 | x |
series impedance, imag part (reactance) |
| 2 | b |
total line-charging susceptance. The pi model puts b/2 at each end; it is stored whole, not halved |
| 3 | g |
total charging conductance (transformer iron losses, 0 on lines), also stored whole |
| 4 | gs |
series admittance, real part (conductance). Y = 1/(r+jx) = gs + j·bs |
| 5 | bs |
series admittance, imag part (susceptance) |
| 6 | tap |
transformer tap ratio (1.0 = plain line) |
| 7 | shift |
transformer phase shift, degrees (0 = plain line) |
r,xandgs,bsare the same branch inverted (Y = 1/Z). Both ship so you never compute one from the other.- Bus shunts are not branch properties and are not in this table:
ds.bus_shunt_g/ds.bus_shunt_bin MW / MVAr at 1 pu (divide byds.baseMVAfor per-unit admittance).ds.ybusalready includes them on the diagonal, together with the halved charging and the tap / shift handling. - In PyG format (
fg.load(..., format="pyg")),Data.edge_attris the[E,2]flows (also exposed asData.edge_x) and this[E,8]table isData.edge_phys. On the dataset object it isds.edge_attr.
Where the branch flows live, per format¶
| you have | flows [E,2] |
flow mask [E,2] |
static line physics [E,8] |
|---|---|---|---|
dict record ds[i] or a ds.loader() batch |
["edge_x"] |
["edge_m"] |
["edge_attr"] |
PyG Data or DataBatch (format="pyg") |
.edge_attr or .edge_x |
.edge_mask |
.edge_phys |
ds.export() |
["edge_x"] [n,E,2] |
["edge_m"] |
ds.edge_attr |
One name to watch: the static table's graph/edge_x is the per-unit series reactance of each branch
(ds.branch_x), unrelated to the per-record flow layer edge_x above; the on-disk name changes at
the next data release, the reader already spells the two apart.
The [E,8] physics keep the name edge_attr on dicts and the dataset, and become edge_phys on PyG
objects because PyG's edge_attr slot is its conventional home for per-edge model input, which
here are the flows.
Flows are per record, so they only exist on records and batches. The static per-unit branch
physics live on the dataset as ds.edge_attr [E,8] and one column each as ds.branch_r,
ds.branch_x, ds.branch_b, ds.branch_g, ds.branch_gs, ds.branch_bs, ds.branch_tap,
ds.branch_shift. They are named branch_* because edge_x is the flows' name.
The rest¶
| field | shape | meaning |
|---|---|---|
edge_x |
[E,2] |
[P_from, Q_from], power leaving the from-end (sign = direction). MW/MVAr or pu. |
node_m, edge_m |
[N,4], as edge_x |
1 metered, 0 not. Metering is sparse: read the mask. |
edge_index |
[2,E] |
row 0 from-bus, row 1 to-bus |
y, family |
[N], scalar |
see Labels above (Aq = paper A_o) |
slack |
dataset attribute | index of the reference (slack) bus, ds.slack. Derived from the clean layer. Also Data.slack in PyG format |
ybus |
dataset attribute | full nodal admittance matrix [N,N], complex per-unit, in node_x bus order: ds.ybus (torch complex128) or ds.ybus_np. Built from edge_attr and the bus shunts with pandapower's branch model, equal to the engine's matrix. Static per shard, so it lives on the dataset, not on each record |
yf, yt |
dataset attributes | from-end and to-end branch admittance matrices [E,N] (rows follow edge_index, columns node_x bus order): ds.yf / ds.yt (torch complex128) or ds.yf_np / ds.yt_np. For a complex bus voltage vector V, V[from] * conj(Yf @ V) is the from-end branch flow in per-unit (times baseMVA gives edge_x / edge_clean units). Same construction as makeYbus |
stealthy |
scalar | 1 for the re-solve families Aq/At/Al/Am (fg.STEALTHY_FAMILIES, BDD-evading by construction), 0 for benign and Ad/As/Ar |
seq_id |
scalar | index of the attack episode the frame belongs to, for every family; -1 on benign frames |
split |
scalar | 0/1/2 = train/val/test |
timestep |
scalar | position in the source load profile |
clean, edge_clean and edge_clean_full (v0.7.2+, edge_clean_full v0.15.0+)¶
- The noiseless, attack-free truth at the record's timestep, in
node_xcolumn order. cleancovers every bus with no mask, whatever the meter placement.edge_cleanzeroes unmetered branches, likeedge_x.edge_clean_fullis the same true flow on every branch, metered or not, computed fromcleanthroughyfwhen the file is loaded (V[from] * conj(Yf @ V), timesbaseMVA). It equalsedge_cleanwherever a flow meter exists, so a graph model can supervise every edge.- On benign records
node_x − cleanis the meter error. - This is the state-estimation target.
The three layers of a frame¶
Every frame of a timeline carries three aligned layers, for node and for edge measurements (Layers and labels explains what each is for and which a feature may read):

| layer | meaning |
|---|---|
node_x / edge_x |
observed (attacked + noise). The model input. |
benign / edge_benign |
attack removed, noise kept |
clean / edge_clean |
noiseless true state. The SE target. |
benign − clean= noise.observed − benign= the attack, exactly, for every family: the observed scan is the benign draw plus the attack. For Aq/At/Al/Am that is the attack vector of the local false state on the meters it moves (the tamper masks); the rest readbenignexactly.cleanis the SE target.
The timeline file¶
| group | datasets | note |
|---|---|---|
| attrs | system, N, E, baseMVA, seed, T, families, kind="timeline", the knobs, attacked_frac |
ds.summary() and the registry read these |
| attrs | episodes_requested, episodes_built, episode_redraws, episodes_dropped, episode_shortfall, fallback_benign |
how the episodes were placed; see below |
| attrs | power_floor_mw |
only in a file made with MeterSettings.power_floor_pu; see below |
data/ |
node_x, node_m, edge_x, edge_m, y, family, stealthy, seq_id, timestep, split, temporal_delta, swing |
one row per frame, time order |
benign/ |
node_benign, edge_benign |
the attack removed |
clean/ |
node_clean, edge_clean |
the noiseless truth per frame |
graph/ |
edge_index and the static branch physics and bus shunts |
the same for every frame |
episodes/ |
onset, length, family, bus_ptr, bus_idx; the min_ and am_ tables |
ds.episodes reads the first five; the episode tables lists them all |
attack/ |
mag_ptr, mag_bus, mag, node_tamper, edge_tamper |
designed magnitude per attacked bus, unsigned (a load rise and a drop of the same size record the same value); the meters the attacker wrote |
data/, benign/, attack/ |
pmu_i, pmu_i_m; pmu_i_benign; pmu_i_tamper |
hybrid-meter files only (attrs["meter_model"] == "hybrid", new generation): the PMU branch currents [T, E, 4], see below |
On a hybrid-meter file a SCADA voltmeter reads no angle, so node_m[:, 3] is 1 at the PMU buses only,
and each PMU reads the current phasor of every in-service branch at its bus [WU26, eqs. 19-20]. The
columns of pmu_i are defined in fdia_graph.constants.channels.CurrentChannel (RE_FROM, IM_FROM,
RE_TO, IM_TO): the real and imaginary part of I_from = Y_f V and I_to = Y_t V in per unit on the base
current, the same on a units="pu" or "physical" view, zero where no PMU reads that end
(pmu_i_m is 0 there). pmu_i_benign is the attack-removed twin and pmu_i_tamper marks the
channels the attacker wrote. A file without these datasets (every released file) loads unchanged
and its records carry no pmu_i. export(["prev_pmu_i"]) gives the previous emitted frame's
currents on a hybrid-meter timeline, like prev_node_x.
Chunked along the frame axis so a window of W frames is one read. A file without the kind attribute
timeline (a record shard of a data release before v0.8.0) is refused with NotATimeline.
The placement attributes¶
The writer stores how the walk placed the episodes. The first five are tables with one row per split and one column per family.
| attribute | holds |
|---|---|
episodes_requested |
the episodes the plan asked for |
episodes_built |
the episodes that began and were written |
episode_redraws |
the times an episode that could not begin at its onset was moved to a later onset of its split |
episodes_dropped |
the episodes the plan could not place because the split had no free onset left |
episode_shortfall |
episodes_requested less episodes_built: the episodes the file lacks, for either reason |
fallback_benign |
the frames inside an episode's window stored as benign, because their attack could not be built |
A ramp that no support holds inside its stealth bound cannot begin: it is moved, which
episode_redraws counts, and if it is never placed it shows in episode_shortfall.
power_floor_mw is the absolute floor under the accuracy class of the file's power meters, in MW.
It is stored only when the file was made with a floor of its own
(MeterSettings.power_floor_pu). A file without it has the package's floor, 0.001 MW. fg.load,
the clients' reader and the state estimator read it.
The episode tables¶
episodes/ holds three tables, each stored as one dataset per column. The names are defined in
src/fdia_graph/schema.py and written by TimelineWriter (src/fdia_graph/generation/write.py).
An episode's index is its row in the first table; data/seq_id holds it for each attacked frame of
the episode and is -1 on a benign frame. A frame inside an episode's window whose attack could not
be built is stored as benign, with -1; the file's fallback_benign attribute counts them. Buses
and branches are positions: a bus is a row of the node layers, a branch a column of
graph/edge_index.
Every episode, one row per episode (n episodes):
| dataset | shape | dtype | holds |
|---|---|---|---|
onset |
[n] |
int32 | the episode's first frame, counted in the file's frames |
length |
[n] |
int32 | its length in frames |
family |
[n] |
int8 | its family code, as in data/family |
bus_ptr |
[n + 1] |
int64 | where each episode's buses start in bus_idx: episode k owns bus_idx[bus_ptr[k]:bus_ptr[k + 1]] |
bus_idx |
[bus_ptr[n]] |
int32 | the buses each episode attacks, one list after another |
The support search, one row per episode whose support a search chose (m rows). Of the
package's two designs, a ramp At has a row when SearchSettings.min_tamper is on, which is the
default, and an overload Am always has one. A file with no such row has none of these datasets.
Noise here is the meter's accuracy class at its true reading, the noise the file's readings carry.
| dataset | shape | dtype | holds |
|---|---|---|---|
min_episode |
[m] |
int32 | the episode's index |
min_devices |
[m] |
int32 | the devices the chosen support moves beyond their noise at some snapshot of the window: 0 or more for a ramp (0 when every change stays under the noise), 1 or more for an overload |
min_channels |
[m] |
int32 | the channels it moves beyond their noise at some snapshot: 0 or more |
min_evaluated |
[m] |
int32 | the candidate supports the search solved |
min_support_ptr |
[m + 1] |
int64 | where each row's support starts in min_support_idx |
min_support_idx |
[min_support_ptr[m]] |
int32 | the buses of each chosen support, sorted, one list after another |
Every episode is on the support its row gives: an episode for which no support was found is not in
the file. These counts are not the tamper masks. min_devices and min_channels count what moves beyond
noise somewhere in the window. For a ramp or an overload, attack/node_tamper and
attack/edge_tamper mark every stored reading the attack changed in a frame, however little.
The overload, one row per target branch of each Am episode (a rows, two per episode by
default, OverloadSettings.n_lines). A file with no such row has none of these datasets.
Flows are apparent flows at the from end, in MVA.
| dataset | shape | dtype | holds |
|---|---|---|---|
am_episode |
[a] |
int32 | the episode's index |
am_line |
[a] |
int32 | the target branch |
am_rating_mva |
[a] |
float32 | the branch's rating S_max |
am_target_mva |
[a] |
float32 | the goal's flow at the last snapshot of the window. The goal ends at the rating, so this equals am_rating_mva |
am_reached_mva |
[a] |
float32 | the flow the false state of the last frame reaches, before noise; NaN when that frame could not be built |
am_emitted_mva |
[a] |
float32 | the flow the meter reported in the last frame that was built, noise included; NaN when no frame was built |
attack/mag_ptr [T + 1] (int64), attack/mag_bus (int32) and attack/mag (float32) are ragged the
same way, with one list per frame: the buses with a designed magnitude in that frame, and the
magnitude of each.
Where the constants and the models are defined¶
A value nothing in a run changes is a constant. Each one is defined once, with its unit and its
source, in a module of src/fdia_graph/constants/. The modules import nothing from the rest of
the toolkit.
Module, under src/fdia_graph/ |
Holds |
|---|---|
constants/channels.py |
the column of each quantity in a measurement array, as enums: node_x[..., NodeChannel.P_INJ] |
constants/families.py |
the attack families and their codes |
constants/meters.py |
the meter kinds, the accuracy classes and the noise floors |
constants/grid.py |
the IEEE cases, the bus types, the "no limit" ratings |
constants/time.py |
the calendar, the New York frame, and how a load profile is correlated from scan to scan |
constants/streams.py |
the keys of the random streams |
constants/numerics.py |
the fixed tolerances |
constants/records.py |
the fields of a record, by group |
constants/files.py |
the names and layouts of the files around a timeline |
constants/releases.py |
where the datasets are published, the pinned data release and its sha256 values |
constants/newyork.py |
the New York grid: the NYISO zones, the fields of the case file, the pinned inputs, the dispatch numbers and the fitted load model |
schema.py holds the file protocol instead: every group, dataset and attribute name of a
timeline file. A value a user tunes is not a constant: it is a field of a settings model.
Every bundle of values a toolkit passes or returns is a model. A model is imported from its
module; a models/ package exports no name.
Module, under src/ |
Holds |
|---|---|
fdia_graph/models/base.py |
Bundle, the base of every model |
fdia_graph/models/fields.py |
the fields the record bundles share |
fdia_graph/models/grid.py |
the static description of a system: the branch model and the admittance matrices |
fdia_graph/models/frames.py |
what the generator passes around per scan: a scan, a frame, an episode's design |
fdia_graph/models/plan.py |
a timeline's plan and its design records |
fdia_graph/models/data.py |
what a user gets back: a record, a batch, a whole split, a summary, the episode table |
fdia_graph/models/assets.py |
where a dataset comes from and where its bytes are fetched from |
fdia_graph/models/config.py |
the settings |
fdia_graph/models/inputs.py |
what the formulas and the parsers accept |
fdia_graph/models/validation.py |
the one engine that checks them |
fdia_graph/models/choices.py |
the arguments with a fixed set of values |
Module, under analysis/src/ |
Holds |
|---|---|
fdia_analysis/models/config.py |
the settings of the analysis packages, checked by the generation toolkit's engine |
fdia_analysis/models/inputs.py |
what the analysis formulas accept |
fdia_analysis/models/choices.py |
the arguments with a fixed set of values |
fdia_analysis/models/scores.py |
the score tables |
fdia_analysis/models/data.py |
the truth an estimator is scored against |
fdia_analysis/models/grid.py |
the estimator's pseudo-measurement records |
fdia_analysis/models/federated.py |
how the buses split into clients |
fdia_analysis/models/training.py |
what the learned localizers pass between their fitting pieces |
fdia_analysis/models/results.py |
the records of the results store |
The section below lists every field of the models a user receives.
Models¶
Every dict the two toolkits return is a typed bundle (fdia_graph.models.base.Bundle): a frozen
dataclass that is also the dict it always was, so out["node_x"], **out and iteration
keep working and out.node_x is new. Fields set to None are absent from the dict. The loader's
bundles are the generation toolkit's (fdia_graph.models), the score tables the analysis
toolkit's (fdia_analysis.models). Generated by tools/models_doc.py from the dataclasses.
RecordBundle (fdia_graph.models.data)¶
One record as FdiaGraph[i] returns it (format="torch"): tensors in self.units with no leading axis, the static graph shared by every record, the label and provenance, and the optional layers the file carries (the benign layer on a timeline file). A dict as well, so DataLoaders, **item and item["node_x"] work.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
edge_index |
edge_index |
Array | yes | [2, E] from and to bus of every branch |
node_x |
node_x |
Array | yes | [..., N, 4] |V|, P_inj, Q_inj, theta (zero where unmetered) |
node_m |
node_m |
Array | yes | [..., N, 4] meter mask, 1 metered |
edge_x |
edge_x |
Array | yes | [..., E, 2] P_from, Q_from |
edge_m |
edge_m |
Array | yes | [..., E, 2] flow-meter mask |
y |
y |
Array | yes | [..., N] per-bus attack label, 1 attacked |
family |
family |
Scalars | yes | [...] 0 benign, 1 Aq, 2 Ad, 3 As, 4 Ar, 5 At, 6 Al, 7 Am (timeline) |
stealthy |
stealthy |
Scalars | yes | [...] 1 for the re-solve families Aq, At, Al, Am |
seq_id |
seq_id |
Scalars | yes | [...] episode index of the frame's attack (every family), -1 benign |
timestep |
timestep |
Scalars | yes | [...] position in the source load profile |
edge_attr |
edge_attr |
Array | [E, 8] per-unit line physics r, x, b, g, gs, bs, tap, shift (v0.5.0+) | |
temporal_delta |
temporal_delta |
Array | [..., N, 2] injection change vs the previous pool scan (v0.3+) | |
swing |
swing |
Array | [..., N, 2] that change as a z-score of recent change (v0.4.1+) | |
clean |
clean |
Array | [..., N, 4] true state at the record's timestep | |
edge_clean |
edge_clean |
Array | [..., E, 2] exact true flows on metered branches | |
edge_clean_full |
edge_clean_full |
Array | [..., E, 2] exact true flows on every branch (v0.15.0+) | |
benign |
benign |
Array | [..., N, 4] attack removed, noise kept | |
edge_benign |
edge_benign |
Array | [..., E, 2] attack removed, noise kept | |
pmu_i |
pmu_i |
Array | [..., E, 4] observed (attacked where attacked), noise kept | |
pmu_i_m |
pmu_i_m |
Array | [..., E, 4] 1 where a PMU reads that end of the branch | |
pmu_i_benign |
pmu_i_benign |
Array | [..., E, 4] attack removed, noise kept |
BatchBundle (fdia_graph.models.data)¶
A batch of records as FdiaGraph.collate builds it: per-record tensors stacked along a leading batch axis B, the static graph once (the first record's), scalar metadata as long tensors [B].
| field | dict key | type | required | meaning |
|---|---|---|---|---|
node_x |
node_x |
Array | yes | [..., N, 4] |V|, P_inj, Q_inj, theta (zero where unmetered) |
node_m |
node_m |
Array | yes | [..., N, 4] meter mask, 1 metered |
edge_x |
edge_x |
Array | yes | [..., E, 2] P_from, Q_from |
edge_m |
edge_m |
Array | yes | [..., E, 2] flow-meter mask |
y |
y |
Array | yes | [..., N] per-bus attack label, 1 attacked |
temporal_delta |
temporal_delta |
Array | [..., N, 2] injection change vs the previous pool scan (v0.3+) | |
swing |
swing |
Array | [..., N, 2] that change as a z-score of recent change (v0.4.1+) | |
clean |
clean |
Array | [..., N, 4] true state at the record's timestep | |
edge_clean |
edge_clean |
Array | [..., E, 2] exact true flows on metered branches | |
edge_clean_full |
edge_clean_full |
Array | [..., E, 2] exact true flows on every branch (v0.15.0+) | |
benign |
benign |
Array | [..., N, 4] attack removed, noise kept | |
edge_benign |
edge_benign |
Array | [..., E, 2] attack removed, noise kept | |
edge_index |
edge_index |
Array | [2, E] from and to bus of every branch | |
edge_attr |
edge_attr |
Array | [E, 8] per-unit line physics r, x, b, g, gs, bs, tap, shift (v0.5.0+) | |
family |
family |
Scalars | [...] 0 benign, 1 Aq, 2 Ad, 3 As, 4 Ar, 5 At, 6 Al, 7 Am (timeline) | |
stealthy |
stealthy |
Scalars | [...] 1 for the re-solve families Aq, At, Al, Am | |
seq_id |
seq_id |
Scalars | [...] episode index of the frame's attack (every family), -1 benign | |
timestep |
timestep |
Scalars | [...] position in the source load profile | |
pmu_i |
pmu_i |
Array | [..., E, 4] observed (attacked where attacked), noise kept | |
pmu_i_m |
pmu_i_m |
Array | [..., E, 4] 1 where a PMU reads that end of the branch | |
pmu_i_benign |
pmu_i_benign |
Array | [..., E, 4] attack removed, noise kept |
ArraysBundle (fdia_graph.models.data)¶
A whole split of n records as export returns it (arrays, or tensors with format="torch" or "tf"), leading axis n: every per-record field that was requested and the file carries, plus the static graph. Fields not requested are absent from the dict view.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
edge_index |
edge_index |
Array | [2, E] from and to bus of every branch | |
node_x |
node_x |
Array | [..., N, 4] |V|, P_inj, Q_inj, theta (zero where unmetered) | |
node_m |
node_m |
Array | [..., N, 4] meter mask, 1 metered | |
edge_x |
edge_x |
Array | [..., E, 2] P_from, Q_from | |
edge_m |
edge_m |
Array | [..., E, 2] flow-meter mask | |
y |
y |
Array | [..., N] per-bus attack label, 1 attacked | |
temporal_delta |
temporal_delta |
Array | [..., N, 2] injection change vs the previous pool scan (v0.3+) | |
swing |
swing |
Array | [..., N, 2] that change as a z-score of recent change (v0.4.1+) | |
clean |
clean |
Array | [..., N, 4] true state at the record's timestep | |
edge_clean |
edge_clean |
Array | [..., E, 2] exact true flows on metered branches | |
edge_clean_full |
edge_clean_full |
Array | [..., E, 2] exact true flows on every branch (v0.15.0+) | |
benign |
benign |
Array | [..., N, 4] attack removed, noise kept | |
edge_benign |
edge_benign |
Array | [..., E, 2] attack removed, noise kept | |
family |
family |
Scalars | [...] 0 benign, 1 Aq, 2 Ad, 3 As, 4 Ar, 5 At, 6 Al, 7 Am (timeline) | |
stealthy |
stealthy |
Scalars | [...] 1 for the re-solve families Aq, At, Al, Am | |
seq_id |
seq_id |
Scalars | [...] episode index of the frame's attack (every family), -1 benign | |
timestep |
timestep |
Scalars | [...] position in the source load profile | |
prev_node_x |
prev_node_x |
Array | [..., N, 4] the previous frame's node readings | |
prev_edge_x |
prev_edge_x |
Array | [..., E, 2] the previous frame's branch-flow readings | |
prev_timestep |
prev_timestep |
Array | [...] the previous frame's pool timestep | |
prev_swing |
prev_swing |
Array | [..., N, 2] the previous frame's swing (dimensionless) | |
edge_attr |
edge_attr |
Array | [E, 8] per-unit line physics r, x, b, g, gs, bs, tap, shift (v0.5.0+) | |
pmu_i |
pmu_i |
Array | [..., E, 4] observed (attacked where attacked), noise kept | |
pmu_i_m |
pmu_i_m |
Array | [..., E, 4] 1 where a PMU reads that end of the branch | |
pmu_i_benign |
pmu_i_benign |
Array | [..., E, 4] attack removed, noise kept | |
prev_pmu_i |
prev_pmu_i |
Array | [..., E, 4] the previous frame's PMU branch currents (hybrid meters) |
EpisodeTable (fdia_graph.models.data)¶
FdiaGraph.episodes on a timeline file: one row per attack episode in the view.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
onset |
onset |
array | yes | [K] the file row (frame) the episode starts at |
length |
length |
array | yes | [K] frames |
family |
family |
array | yes | [K] family code |
buses |
buses |
list[array] | yes | K arrays, the buses the episode labelled |
Summary (fdia_graph.models.data)¶
FdiaGraph.summary(): the system, its size, the number of records in the view, and the record count per family present.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
system |
system |
int | yes | bus count of the system (14, 118, 300, ...) |
N |
N |
int | yes | buses |
E |
E |
int | yes | branches |
n |
n |
int | yes | records in this view |
families |
families |
dict[str, int] | yes | record count per family name present |
ErrorPair (fdia_analysis.models.scores)¶
Mean absolute error of one record class: angles in degrees, voltage magnitudes per unit.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
angle_mae_deg |
angle_mae_deg |
float | yes | mean |theta_hat - theta| over buses and records, degrees |
voltage_mae_pu |
voltage_mae_pu |
float | yes | mean ||V|_hat - |V|| over buses and records, per unit |
EstimatorScores (fdia_analysis.models.scores)¶
SEBase.score: the error pair of every record class present and their geometric mean (geo, the estimation paper's table cell). Indexable by family name as before, geo last.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
benign |
benign |
ErrorPair | attack-free records | |
Aq |
Aq |
ErrorPair | stealthy re-solve attack | |
Ad |
Ad |
ErrorPair | additive bias | |
As |
As |
ErrorPair | scaling | |
Ar |
Ar |
ErrorPair | replay | |
At |
At |
ErrorPair | slow ramp | |
Al |
Al |
ErrorPair | load redistribution | |
Am |
Am |
ErrorPair | multi-snapshot (timeline files) | |
geo |
geo |
ErrorPair | yes | geometric mean over the classes present |
OverallMetrics (fdia_analysis.models.scores)¶
Pooled over every record, benign included: the papers' per-bus macro F1, detection rate and false-positive rate over the active buses (attacked somewhere in the records scored), and the micro node F1.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
macro_f1 |
macro_f1 |
float | yes | mean per-bus F1 over the active buses |
macro_dr |
macro_dr |
float | yes | mean per-bus detection rate over the active buses |
macro_fr |
macro_fr |
float | yes | mean per-bus false-positive rate on benign records |
node_f1 |
node_f1 |
float | yes | micro F1 over every bus call |
BenignMetrics (fdia_analysis.models.scores)¶
On benign records: the record-level false-alarm rate and the mean per-bus alarm rate.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
false_alarm_rate |
false_alarm_rate |
float | yes | benign records with any bus flagged |
bus_alarm_rate |
bus_alarm_rate |
float | yes | mean per-bus flag rate on benign records (calibrated to fa_target) |
FamilyMetrics (fdia_analysis.models.scores)¶
On one attacked family: strict localization accuracy, micro node precision/recall/F1, per-bus macro F1 over the buses the family attacks, per-sample F1, and the record-level detection rate.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
strict_acc |
strict_acc |
float | yes | records whose flagged set equals the attacked set |
node_precision |
node_precision |
float | yes | micro precision over bus calls |
node_recall |
node_recall |
float | yes | micro recall over bus calls |
node_f1 |
node_f1 |
float | yes | micro F1 over bus calls |
macro_f1 |
macro_f1 |
float | yes | mean per-bus F1 over the buses the family attacks |
sample_f1 |
sample_f1 |
float | yes | mean per-record F1 |
detection_rate |
detection_rate |
float | yes | records with any bus flagged |
LocalizerScores (fdia_analysis.models.scores)¶
LocalizerBase.score: all (pooled), benign, and one entry per attacked family present. Indexable by family name as before.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
all |
all |
OverallMetrics | yes | pooled over every record |
benign |
benign |
BenignMetrics | attack-free records | |
Aq |
Aq |
FamilyMetrics | stealthy re-solve attack | |
Ad |
Ad |
FamilyMetrics | additive bias | |
As |
As |
FamilyMetrics | scaling | |
Ar |
Ar |
FamilyMetrics | replay | |
At |
At |
FamilyMetrics | slow ramp | |
Al |
Al |
FamilyMetrics | load redistribution | |
Am |
Am |
FamilyMetrics | multi-snapshot (timeline files) |
PerBusMetrics (fdia_analysis.models.scores)¶
One block of per-bus localization metrics at the localizer's thresholds, the federated paper's node-wise table: arrays aligned to bus_index, and their means over those buses.
| field | dict key | type | required | meaning |
|---|---|---|---|---|
bus_index |
bus_index |
array | yes | [B] the buses reported |
threshold |
threshold |
array | yes | [B] each bus's decision threshold |
f1 |
f1 |
array | yes | [B] per-bus F1 |
dr |
dr |
array | yes | [B] per-bus detection rate |
fr |
fr |
array | yes | [B] per-bus false-alarm rate over the negatives counted (see fr_over) |
auprc |
auprc |
array | yes | [B] per-bus average precision of the score, NaN where never attacked |
n_pos |
n_pos |
array | yes | [B] attacked records per bus |
macro_f1 |
macro_f1 |
float | yes | mean of f1 |
macro_dr |
macro_dr |
float | yes | mean of dr |
macro_fr |
macro_fr |
float | yes | mean of fr |
macro_auprc |
macro_auprc |
float | yes | mean of auprc over the buses where it exists (NaN if none) |
PerBusScores (fdia_analysis.models.scores)¶
LocalizerBase.score_perbus: all over every record, and per attacked family the block over that family's records plus the benign ones (the paper's per-type convention).
| field | dict key | type | required | meaning |
|---|---|---|---|---|
all |
all |
PerBusMetrics | yes | every record |
Aq |
Aq |
PerBusMetrics | stealthy re-solve attack (+ benign) | |
Ad |
Ad |
PerBusMetrics | additive bias (+ benign) | |
As |
As |
PerBusMetrics | scaling (+ benign) | |
Ar |
Ar |
PerBusMetrics | replay (+ benign) | |
At |
At |
PerBusMetrics | slow ramp (+ benign) | |
Al |
Al |
PerBusMetrics | load redistribution (+ benign) | |
Am |
Am |
PerBusMetrics | multi-snapshot (+ benign) |
GridScores (fdia_analysis.models.scores)¶
LearnedLocalizer.score_grid: record-level detection, a record flagged when its highest attackable-bus probability exceeds tau (tuned on validation for grid F1).
| field | dict key | type | required | meaning |
|---|---|---|---|---|
tau |
tau |
float | yes | the grid threshold |
false_alarm |
false_alarm |
float | yes | benign records flagged |
detection_rate |
detection_rate |
float | yes | attacked records flagged (every family) |
by_family |
by_family |
dict | yes | detection rate per attacked family present |
TrustScores (fdia_analysis.models.scores)¶
TrustedMeters.score: what securing the selected meters does. cost is the attack cost after each secured meter (the meters the cheapest stealthy attack still has to touch, inf once none is left); detected_before / detected_after the fraction of attacked records of each family present whose largest normalized residual crosses the benign alarm level, with the attacker free to write every meter and with the secured meters reading their un-attacked value; false_alarm the benign record fraction over the alarm level (the calibration target).
| field | dict key | type | required | meaning |
|---|---|---|---|---|
order |
order |
list[int] | yes | the secured meters, in the order they were secured (masked measurement index) |
cost |
cost |
list[float] | yes | the attack cost after each |
detected_before |
detected_before |
dict[str, float] | yes | per family present: detection rate with every meter writable |
detected_after |
detected_after |
dict[str, float] | yes | per family present: detection rate with the secured meters pinned |
false_alarm |
false_alarm |
float | yes | benign records over the alarm level |
JacobianOutputs (fdia_analysis.models.scores)¶
JacobianFeatures.transform: the per-bus block [n, N, 8], the global features [n, 4] (under the dict key "global"), the implied state change [n, SD] and the unexplained residual [n, m].
| field | dict key | type | required | meaning |
|---|---|---|---|---|
bus |
bus |
array | yes | [n, N, 8] per-bus features |
global_ |
global |
array | yes | [n, 4] per-record features, dict key "global" |
dx_hat |
dx_hat |
array | yes | [n, 2N-1] implied state change (H^T W H)^-1 H^T W dz |
r_perp |
r_perp |
array | yes | [n, m] residual the Jacobian cannot explain, (I - P) dz |