docstr: SPE specific metadata.
  
  Parameters
  ----------
  index : int
      Ignored as SPE files only store global metadata.
  exclude_applied : bool
      Ignored. Exists for API compatibility.
  char_encoding : str
      The encoding to use when parsing strings.
  sdt_control : bool
      If `True`, decode special metadata written by the
      SDT-control software if present.
  
  Returns
  -------
  metadata : dict
      Key-value pairs of metadata.
  
  Notes
  -----
  SPE v3 stores metadata as XML, whereas SPE v2 uses a binary format.
  
  .. rubric:: Supported SPE v2 Metadata fields
  
  ROIs : list of dict
      Regions of interest used for recording images. Each dict has the
      "top_left" key containing x and y coordinates of the top left corner,
      the "bottom_right" key with x and y coordinates of the bottom right
      corner, and the "bin" key with number of binned pixels in x and y
      directions.
  comments : list of str
      The SPE format allows for 5 comment strings of 80 characters each.
  controller_version : int
      Hardware version
  logic_output : int
      Definition of output BNC
  amp_hi_cap_low_noise : int
      Amp switching mode
  mode : int
      Timing mode
  exp_sec : float
      Alternative exposure in seconds
  date : str
      Date string
  detector_temp : float
      Detector temperature
  detector_type : int
      CCD / diode array type
  st_diode : int
      Trigger diode
  delay_time : float
      Used with async mode
  shutter_control : int
      Normal, disabled open, or disabled closed
  absorb_live : bool
      on / off
  absorb_mode : int
      Reference strip or file
  can_do_virtual_chip : bool
      True or False whether chip can do virtual chip
  threshold_min_live : bool
      on / off
  threshold_min_val : float
      Threshold minimum value
  threshold_max_live : bool
      on / off
  threshold_max_val : float
      Threshold maximum value
  time_local : str
      Experiment local time
  time_utc : str
      Experiment UTC time
  adc_offset : int
      ADC offset
  adc_rate : int
      ADC rate
  adc_type : int
      ADC type
  adc_resolution : int
      ADC resolution
  adc_bit_adjust : int
      ADC bit adjust
  gain : int
      gain
  sw_version : str
      Version of software which created this file
  spare_4 : bytes
      Reserved space
  readout_time : float
      Experiment readout time
  type : str
      Controller type
  clockspeed_us : float
      Vertical clock speed in microseconds
  readout_mode : ["full frame", "frame transfer", "kinetics", ""]
      Readout mode. Empty string means that this was not set by the
      Software.
  window_size : int
      Window size for Kinetics mode
  file_header_ver : float
      File header version
  chip_size : [int, int]
      x and y dimensions of the camera chip
  virt_chip_size : [int, int]
      Virtual chip x and y dimensions
  pre_pixels : [int, int]
      Pre pixels in x and y dimensions
  post_pixels : [int, int],
      Post pixels in x and y dimensions
  geometric : list of {"rotate", "reverse", "flip"}
      Geometric operations
  sdt_major_version : int
      (only for files created by SDT-control)
      Major version of SDT-control software
  sdt_minor_version : int
      (only for files created by SDT-control)
      Minor version of SDT-control software
  sdt_controller_name : str
      (only for files created by SDT-control)
      Controller name
  exposure_time : float
      (only for files created by SDT-control)
      Exposure time in seconds
  color_code : str
      (only for files created by SDT-control)
      Color channels used
  detection_channels : int
      (only for files created by SDT-control)
      Number of channels
  background_subtraction : bool
      (only for files created by SDT-control)
      Whether background subtraction war turned on
  em_active : bool
      (only for files created by SDT-control)
      Whether EM was turned on
  em_gain : int
      (only for files created by SDT-control)
      EM gain
  modulation_active : bool
      (only for files created by SDT-control)
      Whether laser modulation (“attenuate”) was turned on
  pixel_size : float
      (only for files created by SDT-control)
      Camera pixel size
  sequence_type : str
      (only for files created by SDT-control)
      Type of sequnce (standard, TOCCSL, arbitrary, …)
  grid : float
      (only for files created by SDT-control)
      Sequence time unit (“grid size”) in seconds
  n_macro : int
      (only for files created by SDT-control)
      Number of macro loops
  delay_macro : float
      (only for files created by SDT-control)
      Time between macro loops in seconds
  n_mini : int
      (only for files created by SDT-control)
      Number of mini loops
  delay_mini : float
      (only for files created by SDT-control)
      Time between mini loops in seconds
  n_micro : int (only for files created by SDT-control)
      Number of micro loops
  delay_micro : float (only for files created by SDT-control)
      Time between micro loops in seconds
  n_subpics : int
      (only for files created by SDT-control)
      Number of sub-pictures
  delay_shutter : float
      (only for files created by SDT-control)
      Camera shutter delay in seconds
  delay_prebleach : float
      (only for files created by SDT-control)
      Pre-bleach delay in seconds
  bleach_time : float
      (only for files created by SDT-control)
      Bleaching time in seconds
  recovery_time : float
      (only for files created by SDT-control)
      Recovery time in seconds
  comment : str
      (only for files created by SDT-control)
      User-entered comment. This replaces the "comments" field.
  datetime : datetime.datetime
      (only for files created by SDT-control)
      Combines the "date" and "time_local" keys. The latter two plus
      "time_utc" are removed.
  modulation_script : str
      (only for files created by SDT-control)
      Laser modulation script. Replaces the "spare_4" key.
  bleach_piezo_active : bool
      (only for files created by SDT-control)
      Whether piezo for bleaching was enabled
docstr_tok: ["SPE","specific","metadata",".","Parameters","--","--","--","--","--","index",":","int","Ignored","as","SPE","files","only","store","global","metadata",".","exclude_applied",":","bool","Ignored",".","Exists","for","API","compatibility",".","char_encoding",":","str","The","encoding","to","use","when","parsing","strings",".","sdt_control",":","bool","If","`","True","`",",","decode","special","metadata","written","by","the","SDT-control","software","if","present",".","Returns","--","--","--","-","metadata",":","dict","Key-value","pairs","of","metadata",".","Notes","--","--","-","SPE","v3","stores","metadata","as","XML",",","whereas","SPE","v2","uses","a","binary","format",".","..","rubric",":",":","Supported","SPE","v2","Metadata","fields","ROIs",":","list","of","dict","Regions","of","interest","used","for","recording","images",".","Each","dict","has","the","``","top_left","''","key","containing","x","and","y","coordinates","of","the","top","left","corner",",","the","``","bottom_right","''","key","with","x","and","y","coordinates","of","the","bottom","right","corner",",","and","the","``","bin","''","key","with","number","of","binned","pixels","in","x","and","y","directions",".","comments",":","list","of","str","The","SPE","format","allows","for","5","comment","strings","of","80","characters","each",".","controller_version",":","int","Hardware","version","logic_output",":","int","Definition","of","output","BNC","amp_hi_cap_low_noise",":","int","Amp","switching","mode","mode",":","int","Timing","mode","exp_sec",":","float","Alternative","exposure","in","seconds","date",":","str","Date","string","detector_temp",":","float","Detector","temperature","detector_type",":","int","CCD","\/","diode","array","type","st_diode",":","int","Trigger","diode","delay_time",":","float","Used","with","async","mode","shutter_control",":","int","Normal",",","disabled","open",",","or","disabled","closed","absorb_live",":","bool","on","\/","off","absorb_mode",":","int","Reference","strip","or","file","can_do_virtual_chip",":","bool","True","or","False","whether","chip","can","do","virtual","chip","threshold_min_live",":","bool","on","\/","off","threshold_min_val",":","float","Threshold","minimum","value","threshold_max_live",":","bool","on","\/","off","threshold_max_val",":","float","Threshold","maximum","value","time_local",":","str","Experiment","local","time","time_utc",":","str","Experiment","UTC","time","adc_offset",":","int","ADC","offset","adc_rate",":","int","ADC","rate","adc_type",":","int","ADC","type","adc_resolution",":","int","ADC","resolution","adc_bit_adjust",":","int","ADC","bit","adjust","gain",":","int","gain","sw_version",":","str","Version","of","software","which","created","this","file","spare_4",":","bytes","Reserved","space","readout_time",":","float","Experiment","readout","time","type",":","str","Controller","type","clockspeed_us",":","float","Vertical","clock","speed","in","microseconds","readout_mode",":","[","``","full","frame","''",",","``","frame","transfer","''",",","``","kinetics","''",",","``","''","]","Readout","mode",".","Empty","string","means","that","this","was","not","set","by","the","Software",".","window_size",":","int","Window","size","for","Kinetics","mode","file_header_ver",":","float","File","header","version","chip_size",":","[","int",",","int","]","x","and","y","dimensions","of","the","camera","chip","virt_chip_size",":","[","int",",","int","]","Virtual","chip","x","and","y","dimensions","pre_pixels",":","[","int",",","int","]","Pre","pixels","in","x","and","y","dimensions","post_pixels",":","[","int",",","int","]",",","Post","pixels","in","x","and","y","dimensions","geometric",":","list","of","{","``","rotate","''",",","``","reverse","''",",","``","flip","''","}","Geometric","operations","sdt_major_version",":","int","(","only","for","files","created","by","SDT-control",")","Major","version","of","SDT-control","software","sdt_minor_version",":","int","(","only","for","files","created","by","SDT-control",")","Minor","version","of","SDT-control","software","sdt_controller_name",":","str","(","only","for","files","created","by","SDT-control",")","Controller","name","exposure_time",":","float","(","only","for","files","created","by","SDT-control",")","Exposure","time","in","seconds","color_code",":","str","(","only","for","files","created","by","SDT-control",")","Color","channels","used","detection_channels",":","int","(","only","for","files","created","by","SDT-control",")","Number","of","channels","background_subtraction",":","bool","(","only","for","files","created","by","SDT-control",")","Whether","background","subtraction","war","turned","on","em_active",":","bool","(","only","for","files","created","by","SDT-control",")","Whether","EM","was","turned","on","em_gain",":","int","(","only","for","files","created","by","SDT-control",")","EM","gain","modulation_active",":","bool","(","only","for","files","created","by","SDT-control",")","Whether","laser","modulation","(","\u201c","attenuate","\u201d",")","was","turned","on","pixel_size",":","float","(","only","for","files","created","by","SDT-control",")","Camera","pixel","size","sequence_type",":","str","(","only","for","files","created","by","SDT-control",")","Type","of","sequnce","(","standard",",","TOCCSL",",","arbitrary",",","\u2026",")","grid",":","float","(","only","for","files","created","by","SDT-control",")","Sequence","time","unit","(","\u201c","grid","size","\u201d",")","in","seconds","n_macro",":","int","(","only","for","files","created","by","SDT-control",")","Number","of","macro","loops","delay_macro",":","float","(","only","for","files","created","by","SDT-control",")","Time","between","macro","loops","in","seconds","n_mini",":","int","(","only","for","files","created","by","SDT-control",")","Number","of","mini","loops","delay_mini",":","float","(","only","for","files","created","by","SDT-control",")","Time","between","mini","loops","in","seconds","n_micro",":","int","(","only","for","files","created","by","SDT-control",")","Number","of","micro","loops","delay_micro",":","float","(","only","for","files","created","by","SDT-control",")","Time","between","micro","loops","in","seconds","n_subpics",":","int","(","only","for","files","created","by","SDT-control",")","Number","of","sub-pictures","delay_shutter",":","float","(","only","for","files","created","by","SDT-control",")","Camera","shutter","delay","in","seconds","delay_prebleach",":","float","(","only","for","files","created","by","SDT-control",")","Pre-bleach","delay","in","seconds","bleach_time",":","float","(","only","for","files","created","by","SDT-control",")","Bleaching","time","in","seconds","recovery_time",":","float","(","only","for","files","created","by","SDT-control",")","Recovery","time","in","seconds","comment",":","str","(","only","for","files","created","by","SDT-control",")","User-entered","comment",".","This","replaces","the","``","comments","''","field",".","datetime",":","datetime.datetime","(","only","for","files","created","by","SDT-control",")","Combines","the","``","date","''","and","``","time_local","''","keys",".","The","latter","two","plus","``","time_utc","''","are","removed",".","modulation_script",":","str","(","only","for","files","created","by","SDT-control",")","Laser","modulation","script",".","Replaces","the","``","spare_4","''","key",".","bleach_piezo_active",":","bool","(","only","for","files","created","by","SDT-control",")","Whether","piezo","for","bleaching","was","enabled"]
code: def metadata(
      self,
      index: int = ...,
      exclude_applied: bool = True,
      char_encoding: str = "latin1",
      sdt_control: bool = True,
  ) -> Dict[str, Any]:
      """SPE specific metadata.
  
      Parameters
      ----------
      index : int
          Ignored as SPE files only store global metadata.
      exclude_applied : bool
          Ignored. Exists for API compatibility.
      char_encoding : str
          The encoding to use when parsing strings.
      sdt_control : bool
          If `True`, decode special metadata written by the
          SDT-control software if present.
  
      Returns
      -------
      metadata : dict
          Key-value pairs of metadata.
  
      Notes
      -----
      SPE v3 stores metadata as XML, whereas SPE v2 uses a binary format.
  
      .. rubric:: Supported SPE v2 Metadata fields
  
      ROIs : list of dict
          Regions of interest used for recording images. Each dict has the
          "top_left" key containing x and y coordinates of the top left corner,
          the "bottom_right" key with x and y coordinates of the bottom right
          corner, and the "bin" key with number of binned pixels in x and y
          directions.
      comments : list of str
          The SPE format allows for 5 comment strings of 80 characters each.
      controller_version : int
          Hardware version
      logic_output : int
          Definition of output BNC
      amp_hi_cap_low_noise : int
          Amp switching mode
      mode : int
          Timing mode
      exp_sec : float
          Alternative exposure in seconds
      date : str
          Date string
      detector_temp : float
          Detector temperature
      detector_type : int
          CCD / diode array type
      st_diode : int
          Trigger diode
      delay_time : float
          Used with async mode
      shutter_control : int
          Normal, disabled open, or disabled closed
      absorb_live : bool
          on / off
      absorb_mode : int
          Reference strip or file
      can_do_virtual_chip : bool
          True or False whether chip can do virtual chip
      threshold_min_live : bool
          on / off
      threshold_min_val : float
          Threshold minimum value
      threshold_max_live : bool
          on / off
      threshold_max_val : float
          Threshold maximum value
      time_local : str
          Experiment local time
      time_utc : str
          Experiment UTC time
      adc_offset : int
          ADC offset
      adc_rate : int
          ADC rate
      adc_type : int
          ADC type
      adc_resolution : int
          ADC resolution
      adc_bit_adjust : int
          ADC bit adjust
      gain : int
          gain
      sw_version : str
          Version of software which created this file
      spare_4 : bytes
          Reserved space
      readout_time : float
          Experiment readout time
      type : str
          Controller type
      clockspeed_us : float
          Vertical clock speed in microseconds
      readout_mode : ["full frame", "frame transfer", "kinetics", ""]
          Readout mode. Empty string means that this was not set by the
          Software.
      window_size : int
          Window size for Kinetics mode
      file_header_ver : float
          File header version
      chip_size : [int, int]
          x and y dimensions of the camera chip
      virt_chip_size : [int, int]
          Virtual chip x and y dimensions
      pre_pixels : [int, int]
          Pre pixels in x and y dimensions
      post_pixels : [int, int],
          Post pixels in x and y dimensions
      geometric : list of {"rotate", "reverse", "flip"}
          Geometric operations
      sdt_major_version : int
          (only for files created by SDT-control)
          Major version of SDT-control software
      sdt_minor_version : int
          (only for files created by SDT-control)
          Minor version of SDT-control software
      sdt_controller_name : str
          (only for files created by SDT-control)
          Controller name
      exposure_time : float
          (only for files created by SDT-control)
          Exposure time in seconds
      color_code : str
          (only for files created by SDT-control)
          Color channels used
      detection_channels : int
          (only for files created by SDT-control)
          Number of channels
      background_subtraction : bool
          (only for files created by SDT-control)
          Whether background subtraction war turned on
      em_active : bool
          (only for files created by SDT-control)
          Whether EM was turned on
      em_gain : int
          (only for files created by SDT-control)
          EM gain
      modulation_active : bool
          (only for files created by SDT-control)
          Whether laser modulation (“attenuate”) was turned on
      pixel_size : float
          (only for files created by SDT-control)
          Camera pixel size
      sequence_type : str
          (only for files created by SDT-control)
          Type of sequnce (standard, TOCCSL, arbitrary, …)
      grid : float
          (only for files created by SDT-control)
          Sequence time unit (“grid size”) in seconds
      n_macro : int
          (only for files created by SDT-control)
          Number of macro loops
      delay_macro : float
          (only for files created by SDT-control)
          Time between macro loops in seconds
      n_mini : int
          (only for files created by SDT-control)
          Number of mini loops
      delay_mini : float
          (only for files created by SDT-control)
          Time between mini loops in seconds
      n_micro : int (only for files created by SDT-control)
          Number of micro loops
      delay_micro : float (only for files created by SDT-control)
          Time between micro loops in seconds
      n_subpics : int
          (only for files created by SDT-control)
          Number of sub-pictures
      delay_shutter : float
          (only for files created by SDT-control)
          Camera shutter delay in seconds
      delay_prebleach : float
          (only for files created by SDT-control)
          Pre-bleach delay in seconds
      bleach_time : float
          (only for files created by SDT-control)
          Bleaching time in seconds
      recovery_time : float
          (only for files created by SDT-control)
          Recovery time in seconds
      comment : str
          (only for files created by SDT-control)
          User-entered comment. This replaces the "comments" field.
      datetime : datetime.datetime
          (only for files created by SDT-control)
          Combines the "date" and "time_local" keys. The latter two plus
          "time_utc" are removed.
      modulation_script : str
          (only for files created by SDT-control)
          Laser modulation script. Replaces the "spare_4" key.
      bleach_piezo_active : bool
          (only for files created by SDT-control)
          Whether piezo for bleaching was enabled
      """
  
      if self._file_header_ver < 3:
          if self._char_encoding is not None:
              char_encoding = self._char_encoding
          if self._sdt_meta is not None:
              sdt_control = self._sdt_meta
          return self._metadata_pre_v3(char_encoding, sdt_control)
      return self._metadata_post_v3()
  
imports: from datetime import datetime
  import logging
  import os
  from typing import Any, Callable, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple, Union
  import warnings
  import numpy
  from ..core.request import Request, IOMode, InitializationError
  from ..core.v3_plugin_api import PluginV3, ImageProperties
label_desc: Use image node_id 4 for calling the SpePlugin obj's underlying member method code with example usage: obj.metadata(index, exclude_applied, char_encoding, sdt_control) and returns: self, self