class_docstr: Compressed row representation window.
  Stores the range of active grid cells in each column.
  Any window with contiguous columns can be expressed as a CRWindow.
  Supports efficient iterative construction and updates.
docstr: Parameters
  ----------
  n
      The width of the window, must be equal to the length of series1
  m
      The height of the window, must be equal to the length of series2
  ranges
      The ranges of active cells within a column [[start_column0, end_column0], ...]
      with shape (n, 2) and where start >= 0 and end <= m.
docstr_tok: ["Parameters","--","--","--","--","--","n","The","width","of","the","window",",","must","be","equal","to","the","length","of","series1","m","The","height","of","the","window",",","must","be","equal","to","the","length","of","series2","ranges","The","ranges","of","active","cells","within","a","column","[","[","start_column0",",","end_column0","]",",","...","]","with","shape","(","n",",","2",")","and","where","start",">","=","0","and","end","<","=","m","."]
code: def __init__(self, n: int, m: int, ranges: np.ndarray = None):
      """
      Parameters
      ----------
      n
          The width of the window, must be equal to the length of series1
      m
          The height of the window, must be equal to the length of series2
      ranges
          The ranges of active cells within a column [[start_column0, end_column0], ...]
          with shape (n, 2) and where start >= 0 and end <= m.
      """
  
      self.n = n
      self.m = m
  
      if ranges is not None:
          raise_if_not(
              ranges.shape == (n, 2),
              f"Expects a 2d array with [start, end] for each column and shape = ({n}, 2)",
          )
  
          ranges = np.insert(ranges, 0, [0, 1], axis=0)
          start = ranges[:, 0]
          end = ranges[:, 1]
  
          raise_if(np.any(start < 0), "Start must be >=0")
          raise_if(np.any(end > m), "End must be <m")
  
          diff = np.maximum(end - start, 0)
          self.length = np.sum(diff)
  
          ranges[1:] += 1
          ranges = ranges.flatten()
      else:
          ranges = np.zeros((n + 1) * 2, dtype=int)
          ranges[0::2] = self.m  # start
          ranges[1::2] = 0  # end
          ranges = array.array("i", ranges)
  
          ranges[0] = 0
          ranges[1] = 1
          self.length = 1
  
      self.column_ranges = array.array("i", ranges)
  
imports: import array
  from abc import ABC, abstractmethod
  from math import atan, tan
  from typing import Tuple
  import numpy
  from darts.logging import raise_if, raise_if_not
label_desc: Use image node_id 1 to create a new CRWindow object from inherited base classes: Window with example: obj = CRWindow(n, m, ranges)