energy_methods.pv_lattice_counting#

Orientation-aware counting of optically resolved PV frame lattices.

PCA rectification, autocorrelation and local contrast checks extend the original horizontal-table counter. This is an experimental image method, not a trained model, super-resolution procedure or verified engineering inventory.

class energy_methods.pv_lattice_counting.LatticeCountingConfig(minimum_chroma=0.018, minimum_component_pixels=300, minimum_aspect=3.0, frame_prominence=0.015, minimum_autocorrelation=0.3, minimum_source_pitch=3.0, maximum_pitch_pixels=30, source_pixel_ratio=1.0, spacing_tolerance=0.3, minimum_panel_fraction=0.55, minimum_cell_contrast=0.003)[source]#

Bases: object

Screening thresholds, not calibrated probabilities or known module counts.

source_pixel_ratio is effective source sampling / finest delivered pixel sampling, at least one. It stops oversampled imagery passing the pitch gate. Colour is (B - R) / (R + G + B); contrast uses 0..1 RGB intensity.

Parameters:
  • minimum_chroma (float)

  • minimum_component_pixels (int)

  • minimum_aspect (float)

  • frame_prominence (float)

  • minimum_autocorrelation (float)

  • minimum_source_pitch (float)

  • maximum_pitch_pixels (int)

  • source_pixel_ratio (float)

  • spacing_tolerance (float)

  • minimum_panel_fraction (float)

  • minimum_cell_contrast (float)

minimum_chroma: float = 0.018#
minimum_component_pixels: int = 300#
minimum_aspect: float = 3.0#
frame_prominence: float = 0.015#
minimum_autocorrelation: float = 0.3#
minimum_source_pitch: float = 3.0#
maximum_pitch_pixels: int = 30#
source_pixel_ratio: float = 1.0#
spacing_tolerance: float = 0.3#
minimum_panel_fraction: float = 0.55#
minimum_cell_contrast: float = 0.003#
class energy_methods.pv_lattice_counting.LatticeTable(id, bounds_xyxy, centre_xy, angle_degrees, column_pitch_pixels, row_pitch_pixels, autocorrelation, column_lines, row_lines)[source]#

Bases: object

Image evidence for a rectified table, including all observed frame lines.

Parameters:
  • id (int)

  • bounds_xyxy (tuple[int, int, int, int])

  • centre_xy (tuple[float, float])

  • angle_degrees (float)

  • column_pitch_pixels (float)

  • row_pitch_pixels (float)

  • autocorrelation (float)

  • column_lines (tuple[float, ...])

  • row_lines (tuple[float, ...])

id: int#
bounds_xyxy: tuple[int, int, int, int]#
centre_xy: tuple[float, float]#
angle_degrees: float#
column_pitch_pixels: float#
row_pitch_pixels: float#
autocorrelation: float#
column_lines: tuple[float, ...]#
row_lines: tuple[float, ...]#
class energy_methods.pv_lattice_counting.LatticeCount(image_shape, config, tables, cells, rejected_tables)[source]#

Bases: object

Candidates and explicit rejected cells/tables; None means unresolved.

Parameters:
image_shape: tuple[int, int]#
config: LatticeCountingConfig#
tables: tuple[LatticeTable, ...]#
cells: tuple[ModuleCandidate, ...]#
rejected_tables: tuple[dict[str, Any], ...]#
property estimated_modules: int | None#
to_frame()[source]#

Export accepted and rejected grid cells in original-image coordinates.

Return type:

DataFrame

energy_methods.pv_lattice_counting.count_lattice_pv_modules(rgb, site_mask=None, *, config=None, maximum_pixels=4000000, maximum_cells=100000)[source]#

Find rotated blue/grey tables and count cells bounded by observed frame lines.

The long-axis period is checked independently with autocorrelation. At least three transverse lines (two module rows) must be visible. Missing lines and irregular gaps are excluded; no lattice positions or table edges are invented. Interpolation only rectifies the input: it adds no optical information.

Table ends, mounting hardware, glare and faint frames can reduce recall. A lattice can still be a cell pattern or another repeated structure: evaluate against image annotations and independent records before interpreting modules.

Parameters:
  • rgb (ndarray[tuple[Any, ...], dtype[Any]])

  • site_mask (ndarray[tuple[Any, ...], dtype[bool]] | None)

  • config (LatticeCountingConfig | None)

  • maximum_pixels (int)

  • maximum_cells (int)

Return type:

LatticeCount