repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
quintusdias/glymur
glymur/jp2box.py
XMLBox.parse
def parse(cls, fptr, offset, length): """Parse XML box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse XML box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse XML box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- XMLBox Instance of the current XML bo...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2901-L2968
quintusdias/glymur
glymur/jp2box.py
UUIDListBox.write
def write(self, fptr): """Write a UUID list box to file. """ num_uuids = len(self.ulst) length = 4 + 4 + 2 + num_uuids * 16 write_buffer = struct.pack('>I4sH', length, b'ulst', num_uuids) fptr.write(write_buffer) for j in range(num_uuids): fptr.write(...
python
def write(self, fptr): """Write a UUID list box to file. """ num_uuids = len(self.ulst) length = 4 + 4 + 2 + num_uuids * 16 write_buffer = struct.pack('>I4sH', length, b'ulst', num_uuids) fptr.write(write_buffer) for j in range(num_uuids): fptr.write(...
Write a UUID list box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3015-L3024
quintusdias/glymur
glymur/jp2box.py
UUIDListBox.parse
def parse(cls, fptr, offset, length): """Parse UUIDList box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse UUIDList box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse UUIDList box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- UUIDListBox Instance of the current...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3027-L3054
quintusdias/glymur
glymur/jp2box.py
DataEntryURLBox.write
def write(self, fptr): """Write a data entry url box to file. """ # Make sure it is written out as null-terminated. url = self.url if self.url[-1] != chr(0): url = url + chr(0) url = url.encode() length = 8 + 1 + 3 + len(url) write_buffer = st...
python
def write(self, fptr): """Write a data entry url box to file. """ # Make sure it is written out as null-terminated. url = self.url if self.url[-1] != chr(0): url = url + chr(0) url = url.encode() length = 8 + 1 + 3 + len(url) write_buffer = st...
Write a data entry url box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3154-L3169
quintusdias/glymur
glymur/jp2box.py
DataEntryURLBox.parse
def parse(cls, fptr, offset, length): """Parse data entry URL box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -----...
python
def parse(cls, fptr, offset, length): """Parse data entry URL box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -----...
Parse data entry URL box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- DataEntryURLbox Instance o...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3196-L3220
quintusdias/glymur
glymur/jp2box.py
UUIDBox._parse_raw_data
def _parse_raw_data(self): """ Private function for parsing UUID payloads if possible. """ if self.uuid == _XMP_UUID: txt = self.raw_data.decode('utf-8') elt = ET.fromstring(txt) self.data = ET.ElementTree(elt) elif self.uuid == _GEOTIFF_UUID: ...
python
def _parse_raw_data(self): """ Private function for parsing UUID payloads if possible. """ if self.uuid == _XMP_UUID: txt = self.raw_data.decode('utf-8') elt = ET.fromstring(txt) self.data = ET.ElementTree(elt) elif self.uuid == _GEOTIFF_UUID: ...
Private function for parsing UUID payloads if possible.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3309-L3323
quintusdias/glymur
glymur/jp2box.py
UUIDBox._print_geotiff
def _print_geotiff(self): """ Print geotiff information. Shamelessly ripped off from gdalinfo.py Returns ------- str String representation of the degenerate geotiff. """ if self.data is None: return "corrupt" in_mem_name = '/vsime...
python
def _print_geotiff(self): """ Print geotiff information. Shamelessly ripped off from gdalinfo.py Returns ------- str String representation of the degenerate geotiff. """ if self.data is None: return "corrupt" in_mem_name = '/vsime...
Print geotiff information. Shamelessly ripped off from gdalinfo.py Returns ------- str String representation of the degenerate geotiff.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3380-L3449
quintusdias/glymur
glymur/jp2box.py
UUIDBox.write
def write(self, fptr): """Write a UUID box to file. """ length = 4 + 4 + 16 + len(self.raw_data) write_buffer = struct.pack('>I4s', length, b'uuid') fptr.write(write_buffer) fptr.write(self.uuid.bytes) fptr.write(self.raw_data)
python
def write(self, fptr): """Write a UUID box to file. """ length = 4 + 4 + 16 + len(self.raw_data) write_buffer = struct.pack('>I4s', length, b'uuid') fptr.write(write_buffer) fptr.write(self.uuid.bytes) fptr.write(self.raw_data)
Write a UUID box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3473-L3480
quintusdias/glymur
glymur/jp2box.py
UUIDBox.parse
def parse(cls, fptr, offset, length): """Parse UUID box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse UUID box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse UUID box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- UUIDBox Instance of the current UUID...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L3483-L3503
quintusdias/glymur
glymur/codestream.py
_parse_precinct_size
def _parse_precinct_size(spcod): """Compute precinct size from SPcod or SPcoc.""" spcod = np.frombuffer(spcod, dtype=np.uint8) precinct_size = [] for item in spcod: ep2 = (item & 0xF0) >> 4 ep1 = item & 0x0F precinct_size.append((2 ** ep1, 2 ** ep2)) return tuple(precinct_siz...
python
def _parse_precinct_size(spcod): """Compute precinct size from SPcod or SPcoc.""" spcod = np.frombuffer(spcod, dtype=np.uint8) precinct_size = [] for item in spcod: ep2 = (item & 0xF0) >> 4 ep1 = item & 0x0F precinct_size.append((2 ** ep1, 2 ** ep2)) return tuple(precinct_siz...
Compute precinct size from SPcod or SPcoc.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L1844-L1852
quintusdias/glymur
glymur/codestream.py
_context_string
def _context_string(context): """Produce a string to represent the code block context""" msg = 'Code block context:\n ' lines = ['Selective arithmetic coding bypass: {0}', 'Reset context probabilities on coding pass boundaries: {1}', 'Termination on each coding pass: ...
python
def _context_string(context): """Produce a string to represent the code block context""" msg = 'Code block context:\n ' lines = ['Selective arithmetic coding bypass: {0}', 'Reset context probabilities on coding pass boundaries: {1}', 'Termination on each coding pass: ...
Produce a string to represent the code block context
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L1855-L1871
quintusdias/glymur
glymur/codestream.py
parse_quantization
def parse_quantization(read_buffer, sqcd): """Tease out the quantization values. Parameters ---------- read_buffer: sequence of bytes from the QCC and QCD segments. Returns ------ tuple Mantissa and exponents from quantization buffer. """ numbytes = len(read_buffer) ...
python
def parse_quantization(read_buffer, sqcd): """Tease out the quantization values. Parameters ---------- read_buffer: sequence of bytes from the QCC and QCD segments. Returns ------ tuple Mantissa and exponents from quantization buffer. """ numbytes = len(read_buffer) ...
Tease out the quantization values. Parameters ---------- read_buffer: sequence of bytes from the QCC and QCD segments. Returns ------ tuple Mantissa and exponents from quantization buffer.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L1874-L1903
quintusdias/glymur
glymur/codestream.py
_print_quantization_style
def _print_quantization_style(sqcc): """Only to be used with QCC and QCD segments.""" msg = '\n Quantization style: ' if sqcc & 0x1f == 0: msg += 'no quantization, ' elif sqcc & 0x1f == 1: msg += 'scalar implicit, ' elif sqcc & 0x1f == 2: msg += 'scalar explicit, ' r...
python
def _print_quantization_style(sqcc): """Only to be used with QCC and QCD segments.""" msg = '\n Quantization style: ' if sqcc & 0x1f == 0: msg += 'no quantization, ' elif sqcc & 0x1f == 1: msg += 'scalar implicit, ' elif sqcc & 0x1f == 2: msg += 'scalar explicit, ' r...
Only to be used with QCC and QCD segments.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L1906-L1916
quintusdias/glymur
glymur/codestream.py
Codestream._parse_unrecognized_segment
def _parse_unrecognized_segment(self, fptr): """Looks like a valid marker, but not sure from reading the specs. """ msg = ("Unrecognized codestream marker 0x{marker_id:x} encountered at " "byte offset {offset}.") msg = msg.format(marker_id=self._marker_id, offset=fptr.tell...
python
def _parse_unrecognized_segment(self, fptr): """Looks like a valid marker, but not sure from reading the specs. """ msg = ("Unrecognized codestream marker 0x{marker_id:x} encountered at " "byte offset {offset}.") msg = msg.format(marker_id=self._marker_id, offset=fptr.tell...
Looks like a valid marker, but not sure from reading the specs.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L224-L242
quintusdias/glymur
glymur/codestream.py
Codestream._parse_reserved_segment
def _parse_reserved_segment(self, fptr): """Parse valid marker segment, segment description is unknown. Parameters ---------- fptr : file object The file to parse. Returns ------- Segment The current segment. """ offset = ...
python
def _parse_reserved_segment(self, fptr): """Parse valid marker segment, segment description is unknown. Parameters ---------- fptr : file object The file to parse. Returns ------- Segment The current segment. """ offset = ...
Parse valid marker segment, segment description is unknown. Parameters ---------- fptr : file object The file to parse. Returns ------- Segment The current segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L244-L268
quintusdias/glymur
glymur/codestream.py
Codestream._parse_tile_part_bit_stream
def _parse_tile_part_bit_stream(self, fptr, sod_marker, tile_length): """Parse the tile part bit stream for SOP, EPH marker segments.""" read_buffer = fptr.read(tile_length) # The tile length could possibly be too large and extend past # the end of file. We need to be a bit resilient. ...
python
def _parse_tile_part_bit_stream(self, fptr, sod_marker, tile_length): """Parse the tile part bit stream for SOP, EPH marker segments.""" read_buffer = fptr.read(tile_length) # The tile length could possibly be too large and extend past # the end of file. We need to be a bit resilient. ...
Parse the tile part bit stream for SOP, EPH marker segments.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L270-L295
quintusdias/glymur
glymur/codestream.py
Codestream._parse_cme_segment
def _parse_cme_segment(self, fptr): """Parse the CME marker segment. Parameters ---------- fptr : file Open file object. Returns ------- CMESegment The current CME segment. """ offset = fptr.tell() - 2 read_buffer...
python
def _parse_cme_segment(self, fptr): """Parse the CME marker segment. Parameters ---------- fptr : file Open file object. Returns ------- CMESegment The current CME segment. """ offset = fptr.tell() - 2 read_buffer...
Parse the CME marker segment. Parameters ---------- fptr : file Open file object. Returns ------- CMESegment The current CME segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L307-L328
quintusdias/glymur
glymur/codestream.py
Codestream._parse_coc_segment
def _parse_coc_segment(self, fptr): """Parse the COC marker segment. Parameters ---------- fptr : file Open file object. Returns ------- COCSegment The current COC segment. """ kwargs = {} offset = fptr.tell() - 2 ...
python
def _parse_coc_segment(self, fptr): """Parse the COC marker segment. Parameters ---------- fptr : file Open file object. Returns ------- COCSegment The current COC segment. """ kwargs = {} offset = fptr.tell() - 2 ...
Parse the COC marker segment. Parameters ---------- fptr : file Open file object. Returns ------- COCSegment The current COC segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L330-L364
quintusdias/glymur
glymur/codestream.py
Codestream._parse_cod_segment
def _parse_cod_segment(cls, fptr): """Parse the COD segment. Parameters ---------- fptr : file Open file object. Returns ------- CODSegment The current COD segment. """ offset = fptr.tell() - 2 read_buffer = fptr....
python
def _parse_cod_segment(cls, fptr): """Parse the COD segment. Parameters ---------- fptr : file Open file object. Returns ------- CODSegment The current COD segment. """ offset = fptr.tell() - 2 read_buffer = fptr....
Parse the COD segment. Parameters ---------- fptr : file Open file object. Returns ------- CODSegment The current COD segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L367-L406
quintusdias/glymur
glymur/codestream.py
Codestream._parse_crg_segment
def _parse_crg_segment(self, fptr): """Parse the CRG marker segment. Parameters ---------- fptr : file Open file object. Returns ------- CRGSegment The current CRG segment. """ offset = fptr.tell() - 2 read_buffer...
python
def _parse_crg_segment(self, fptr): """Parse the CRG marker segment. Parameters ---------- fptr : file Open file object. Returns ------- CRGSegment The current CRG segment. """ offset = fptr.tell() - 2 read_buffer...
Parse the CRG marker segment. Parameters ---------- fptr : file Open file object. Returns ------- CRGSegment The current CRG segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L408-L431
quintusdias/glymur
glymur/codestream.py
Codestream._parse_eoc_segment
def _parse_eoc_segment(self, fptr): """Parse the EOC (end-of-codestream) marker segment. Parameters ---------- fptr : file Open file object. Returns ------- EOCSegment The current EOC segment. """ offset = fptr.tell() - 2 ...
python
def _parse_eoc_segment(self, fptr): """Parse the EOC (end-of-codestream) marker segment. Parameters ---------- fptr : file Open file object. Returns ------- EOCSegment The current EOC segment. """ offset = fptr.tell() - 2 ...
Parse the EOC (end-of-codestream) marker segment. Parameters ---------- fptr : file Open file object. Returns ------- EOCSegment The current EOC segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L433-L449
quintusdias/glymur
glymur/codestream.py
Codestream._parse_plt_segment
def _parse_plt_segment(self, fptr): """Parse the PLT segment. The packet headers are not parsed, i.e. they remain uninterpreted raw data buffers. Parameters ---------- fptr : file Open file object. Returns ------- PLTSegment ...
python
def _parse_plt_segment(self, fptr): """Parse the PLT segment. The packet headers are not parsed, i.e. they remain uninterpreted raw data buffers. Parameters ---------- fptr : file Open file object. Returns ------- PLTSegment ...
Parse the PLT segment. The packet headers are not parsed, i.e. they remain uninterpreted raw data buffers. Parameters ---------- fptr : file Open file object. Returns ------- PLTSegment The current PLT segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L451-L489
quintusdias/glymur
glymur/codestream.py
Codestream._parse_pod_segment
def _parse_pod_segment(self, fptr): """Parse the POD segment. Parameters ---------- fptr : file Open file object. Returns ------- PODSegment The current POD segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
python
def _parse_pod_segment(self, fptr): """Parse the POD segment. Parameters ---------- fptr : file Open file object. Returns ------- PODSegment The current POD segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
Parse the POD segment. Parameters ---------- fptr : file Open file object. Returns ------- PODSegment The current POD segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L491-L516
quintusdias/glymur
glymur/codestream.py
Codestream._parse_ppm_segment
def _parse_ppm_segment(self, fptr): """Parse the PPM segment. Parameters ---------- fptr : file Open file object. Returns ------- PPMSegment The current PPM segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
python
def _parse_ppm_segment(self, fptr): """Parse the PPM segment. Parameters ---------- fptr : file Open file object. Returns ------- PPMSegment The current PPM segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
Parse the PPM segment. Parameters ---------- fptr : file Open file object. Returns ------- PPMSegment The current PPM segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L518-L539
quintusdias/glymur
glymur/codestream.py
Codestream._parse_ppt_segment
def _parse_ppt_segment(self, fptr): """Parse the PPT segment. The packet headers are not parsed, i.e. they remain "uninterpreted" raw data beffers. Parameters ---------- fptr : file object The file to parse. Returns ------- PPTSegmen...
python
def _parse_ppt_segment(self, fptr): """Parse the PPT segment. The packet headers are not parsed, i.e. they remain "uninterpreted" raw data beffers. Parameters ---------- fptr : file object The file to parse. Returns ------- PPTSegmen...
Parse the PPT segment. The packet headers are not parsed, i.e. they remain "uninterpreted" raw data beffers. Parameters ---------- fptr : file object The file to parse. Returns ------- PPTSegment The current PPT segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L541-L567
quintusdias/glymur
glymur/codestream.py
Codestream._parse_qcc_segment
def _parse_qcc_segment(cls, fptr): """Parse the QCC segment. Parameters ---------- fptr : file object The file to parse. Returns ------- QCCSegment The current QCC segment. """ offset = fptr.tell() - 2 read_buffer...
python
def _parse_qcc_segment(cls, fptr): """Parse the QCC segment. Parameters ---------- fptr : file object The file to parse. Returns ------- QCCSegment The current QCC segment. """ offset = fptr.tell() - 2 read_buffer...
Parse the QCC segment. Parameters ---------- fptr : file object The file to parse. Returns ------- QCCSegment The current QCC segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L570-L600
quintusdias/glymur
glymur/codestream.py
Codestream._parse_qcd_segment
def _parse_qcd_segment(self, fptr): """Parse the QCD segment. Parameters ---------- fptr : file Open file object. Returns ------- QCDSegment The current QCD segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
python
def _parse_qcd_segment(self, fptr): """Parse the QCD segment. Parameters ---------- fptr : file Open file object. Returns ------- QCDSegment The current QCD segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
Parse the QCD segment. Parameters ---------- fptr : file Open file object. Returns ------- QCDSegment The current QCD segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L602-L621
quintusdias/glymur
glymur/codestream.py
Codestream._parse_rgn_segment
def _parse_rgn_segment(cls, fptr): """Parse the RGN segment. Parameters ---------- fptr : file Open file object. Returns ------- RGNSegment The current RGN segment. """ offset = fptr.tell() - 2 read_buffer = fptr....
python
def _parse_rgn_segment(cls, fptr): """Parse the RGN segment. Parameters ---------- fptr : file Open file object. Returns ------- RGNSegment The current RGN segment. """ offset = fptr.tell() - 2 read_buffer = fptr....
Parse the RGN segment. Parameters ---------- fptr : file Open file object. Returns ------- RGNSegment The current RGN segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L624-L652
quintusdias/glymur
glymur/codestream.py
Codestream._parse_siz_segment
def _parse_siz_segment(cls, fptr): """Parse the SIZ segment. Parameters ---------- fptr : file Open file object. Returns ------- SIZSegment The current SIZ segment. """ offset = fptr.tell() - 2 read_buffer = fptr....
python
def _parse_siz_segment(cls, fptr): """Parse the SIZ segment. Parameters ---------- fptr : file Open file object. Returns ------- SIZSegment The current SIZ segment. """ offset = fptr.tell() - 2 read_buffer = fptr....
Parse the SIZ segment. Parameters ---------- fptr : file Open file object. Returns ------- SIZSegment The current SIZ segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L655-L742
quintusdias/glymur
glymur/codestream.py
Codestream._parse_sod_segment
def _parse_sod_segment(self, fptr): """Parse the SOD (start-of-data) segment. Parameters ---------- fptr : file Open file object. Returns ------- SODSegment The current SOD segment. """ offset = fptr.tell() - 2 len...
python
def _parse_sod_segment(self, fptr): """Parse the SOD (start-of-data) segment. Parameters ---------- fptr : file Open file object. Returns ------- SODSegment The current SOD segment. """ offset = fptr.tell() - 2 len...
Parse the SOD (start-of-data) segment. Parameters ---------- fptr : file Open file object. Returns ------- SODSegment The current SOD segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L744-L760
quintusdias/glymur
glymur/codestream.py
Codestream._parse_sot_segment
def _parse_sot_segment(self, fptr): """Parse the SOT segment. Parameters ---------- fptr : file Open file object. Returns ------- SOTSegment The current SOT segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
python
def _parse_sot_segment(self, fptr): """Parse the SOT segment. Parameters ---------- fptr : file Open file object. Returns ------- SOTSegment The current SOT segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
Parse the SOT segment. Parameters ---------- fptr : file Open file object. Returns ------- SOTSegment The current SOT segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L762-L799
quintusdias/glymur
glymur/codestream.py
Codestream._parse_tlm_segment
def _parse_tlm_segment(self, fptr): """Parse the TLM segment. Parameters ---------- fptr : file Open file object. Returns ------- TLMSegment The current TLM segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
python
def _parse_tlm_segment(self, fptr): """Parse the TLM segment. Parameters ---------- fptr : file Open file object. Returns ------- TLMSegment The current TLM segment. """ offset = fptr.tell() - 2 read_buffer = fptr...
Parse the TLM segment. Parameters ---------- fptr : file Open file object. Returns ------- TLMSegment The current TLM segment.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L801-L852
quintusdias/glymur
glymur/codestream.py
Codestream._parse_reserved_marker
def _parse_reserved_marker(self, fptr): """Marker range between 0xff30 and 0xff39. """ the_id = '0x{0:x}'.format(self._marker_id) segment = Segment(marker_id=the_id, offset=self._offset, length=0) return segment
python
def _parse_reserved_marker(self, fptr): """Marker range between 0xff30 and 0xff39. """ the_id = '0x{0:x}'.format(self._marker_id) segment = Segment(marker_id=the_id, offset=self._offset, length=0) return segment
Marker range between 0xff30 and 0xff39.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/codestream.py#L854-L859
keenlabs/KeenClient-Python
keen/client.py
Event.to_json
def to_json(self): """ Serializes the event to JSON. :returns: a string """ event_as_dict = copy.deepcopy(self.event_body) if self.timestamp: if "keen" in event_as_dict: event_as_dict["keen"]["timestamp"] = self.timestamp.isoformat() else:...
python
def to_json(self): """ Serializes the event to JSON. :returns: a string """ event_as_dict = copy.deepcopy(self.event_body) if self.timestamp: if "keen" in event_as_dict: event_as_dict["keen"]["timestamp"] = self.timestamp.isoformat() else:...
Serializes the event to JSON. :returns: a string
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L33-L44
keenlabs/KeenClient-Python
keen/client.py
KeenClient.add_event
def add_event(self, event_collection, event_body, timestamp=None): """ Adds an event. Depending on the persistence strategy of the client, this will either result in the event being uploaded to Keen immediately or will result in saving the event to some local cache. :param even...
python
def add_event(self, event_collection, event_body, timestamp=None): """ Adds an event. Depending on the persistence strategy of the client, this will either result in the event being uploaded to Keen immediately or will result in saving the event to some local cache. :param even...
Adds an event. Depending on the persistence strategy of the client, this will either result in the event being uploaded to Keen immediately or will result in saving the event to some local cache. :param event_collection: the name of the collection to insert the event to ...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L120-L134
keenlabs/KeenClient-Python
keen/client.py
KeenClient.generate_image_beacon
def generate_image_beacon(self, event_collection, event_body, timestamp=None): """ Generates an image beacon URL. :param event_collection: the name of the collection to insert the event to :param event_body: dict, the body of the event to insert the event to :param timestamp: da...
python
def generate_image_beacon(self, event_collection, event_body, timestamp=None): """ Generates an image beacon URL. :param event_collection: the name of the collection to insert the event to :param event_body: dict, the body of the event to insert the event to :param timestamp: da...
Generates an image beacon URL. :param event_collection: the name of the collection to insert the event to :param event_body: dict, the body of the event to insert the event to :param timestamp: datetime, optional, the timestamp of the event
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L147-L161
keenlabs/KeenClient-Python
keen/client.py
KeenClient.delete_events
def delete_events(self, event_collection, timeframe=None, timezone=None, filters=None): """ Deletes events. :param event_collection: string, the event collection from which event are being deleted :param timeframe: string or dict, the timeframe in which the events happened example: "pre...
python
def delete_events(self, event_collection, timeframe=None, timezone=None, filters=None): """ Deletes events. :param event_collection: string, the event collection from which event are being deleted :param timeframe: string or dict, the timeframe in which the events happened example: "pre...
Deletes events. :param event_collection: string, the event collection from which event are being deleted :param timeframe: string or dict, the timeframe in which the events happened example: "previous_7_days" :param timezone: int, the timezone you'd like to use for the timeframe ...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L163-L176
keenlabs/KeenClient-Python
keen/client.py
KeenClient.create_access_key
def create_access_key(self, name, is_active=True, permitted=[], options={}): """ Creates a new access key. A master key must be set first. :param name: the name of the access key to create :param is_active: Boolean value dictating whether this key is currently active (default True) ...
python
def create_access_key(self, name, is_active=True, permitted=[], options={}): """ Creates a new access key. A master key must be set first. :param name: the name of the access key to create :param is_active: Boolean value dictating whether this key is currently active (default True) ...
Creates a new access key. A master key must be set first. :param name: the name of the access key to create :param is_active: Boolean value dictating whether this key is currently active (default True) :param permitted: list of strings describing which operation types this key will permit ...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L194-L208
keenlabs/KeenClient-Python
keen/client.py
KeenClient.update_access_key_full
def update_access_key_full(self, access_key_id, name, is_active, permitted, options): """ Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key. A master key must be set first. :param access_key_id: the 'key' value of the access key for which the values will...
python
def update_access_key_full(self, access_key_id, name, is_active, permitted, options): """ Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key. A master key must be set first. :param access_key_id: the 'key' value of the access key for which the values will...
Replaces the 'name', 'is_active', 'permitted', and 'options' values of a given key. A master key must be set first. :param access_key_id: the 'key' value of the access key for which the values will be replaced :param name: the new name desired for this access key :param is_active: wheth...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L278-L289
keenlabs/KeenClient-Python
keen/client.py
KeenClient._base64_encode
def _base64_encode(self, string_to_encode): """ Base64 encodes a string, with either Python 2 or 3. :param string_to_encode: the string to encode """ try: # python 2 return base64.b64encode(string_to_encode) except TypeError: # python 3 ...
python
def _base64_encode(self, string_to_encode): """ Base64 encodes a string, with either Python 2 or 3. :param string_to_encode: the string to encode """ try: # python 2 return base64.b64encode(string_to_encode) except TypeError: # python 3 ...
Base64 encodes a string, with either Python 2 or 3. :param string_to_encode: the string to encode
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L307-L319
keenlabs/KeenClient-Python
keen/client.py
KeenClient.select_unique
def select_unique(self, event_collection, target_property, timeframe=None, timezone=None, interval=None, filters=None, group_by=None, order_by=None, max_age=None, limit=None): """ Performs a select unique query Returns an array of the unique values of a target property for events ...
python
def select_unique(self, event_collection, target_property, timeframe=None, timezone=None, interval=None, filters=None, group_by=None, order_by=None, max_age=None, limit=None): """ Performs a select unique query Returns an array of the unique values of a target property for events ...
Performs a select unique query Returns an array of the unique values of a target property for events that meet the given criteria. :param event_collection: string, the name of the collection to query :param target_property: string, the name of the event property you would like use :par...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L596-L626
keenlabs/KeenClient-Python
keen/client.py
KeenClient.extraction
def extraction(self, event_collection, timeframe=None, timezone=None, filters=None, latest=None, email=None, property_names=None): """ Performs a data extraction Returns either a JSON object of events or a response indicating an email will be sent to you with data. ...
python
def extraction(self, event_collection, timeframe=None, timezone=None, filters=None, latest=None, email=None, property_names=None): """ Performs a data extraction Returns either a JSON object of events or a response indicating an email will be sent to you with data. ...
Performs a data extraction Returns either a JSON object of events or a response indicating an email will be sent to you with data. :param event_collection: string, the name of the collection to query :param timeframe: string or dict, the timeframe in which the events happened ...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L628-L649
keenlabs/KeenClient-Python
keen/client.py
KeenClient.funnel
def funnel(self, steps, timeframe=None, timezone=None, max_age=None, all_keys=False): """ Performs a Funnel query Returns an object containing the results for each step of the funnel. :param steps: array of dictionaries, one for each step. example: [{"event_collection":"signup","actor_...
python
def funnel(self, steps, timeframe=None, timezone=None, max_age=None, all_keys=False): """ Performs a Funnel query Returns an object containing the results for each step of the funnel. :param steps: array of dictionaries, one for each step. example: [{"event_collection":"signup","actor_...
Performs a Funnel query Returns an object containing the results for each step of the funnel. :param steps: array of dictionaries, one for each step. example: [{"event_collection":"signup","actor_property":"user.id"}, {"event_collection":"purchase","actor_property:"user.id"}] :...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/client.py#L651-L675
quintusdias/glymur
glymur/lib/openjpeg.py
version
def version(): """Wrapper for opj_version library routine.""" OPENJPEG.opj_version.restype = ctypes.c_char_p library_version = OPENJPEG.opj_version() if sys.hexversion >= 0x03000000: return library_version.decode('utf-8') else: return library_version
python
def version(): """Wrapper for opj_version library routine.""" OPENJPEG.opj_version.restype = ctypes.c_char_p library_version = OPENJPEG.opj_version() if sys.hexversion >= 0x03000000: return library_version.decode('utf-8') else: return library_version
Wrapper for opj_version library routine.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L18-L25
quintusdias/glymur
glymur/lib/openjpeg.py
cio_open
def cio_open(cinfo, src=None): """Wrapper for openjpeg library function opj_cio_open.""" argtypes = [ctypes.POINTER(CommonStructType), ctypes.c_char_p, ctypes.c_int] OPENJPEG.opj_cio_open.argtypes = argtypes OPENJPEG.opj_cio_open.restype = ctypes.POINTER(CioType) if src is None: ...
python
def cio_open(cinfo, src=None): """Wrapper for openjpeg library function opj_cio_open.""" argtypes = [ctypes.POINTER(CommonStructType), ctypes.c_char_p, ctypes.c_int] OPENJPEG.opj_cio_open.argtypes = argtypes OPENJPEG.opj_cio_open.restype = ctypes.POINTER(CioType) if src is None: ...
Wrapper for openjpeg library function opj_cio_open.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L422-L438
quintusdias/glymur
glymur/lib/openjpeg.py
cio_close
def cio_close(cio): """Wraps openjpeg library function cio_close. """ OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(CioType)] OPENJPEG.opj_cio_close(cio)
python
def cio_close(cio): """Wraps openjpeg library function cio_close. """ OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(CioType)] OPENJPEG.opj_cio_close(cio)
Wraps openjpeg library function cio_close.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L441-L445
quintusdias/glymur
glymur/lib/openjpeg.py
cio_tell
def cio_tell(cio): """Get position in byte stream.""" OPENJPEG.cio_tell.argtypes = [ctypes.POINTER(CioType)] OPENJPEG.cio_tell.restype = ctypes.c_int pos = OPENJPEG.cio_tell(cio) return pos
python
def cio_tell(cio): """Get position in byte stream.""" OPENJPEG.cio_tell.argtypes = [ctypes.POINTER(CioType)] OPENJPEG.cio_tell.restype = ctypes.c_int pos = OPENJPEG.cio_tell(cio) return pos
Get position in byte stream.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L448-L453
quintusdias/glymur
glymur/lib/openjpeg.py
create_compress
def create_compress(fmt): """Wrapper for openjpeg library function opj_create_compress. Creates a J2K/JPT/JP2 compression structure. """ OPENJPEG.opj_create_compress.argtypes = [ctypes.c_int] OPENJPEG.opj_create_compress.restype = ctypes.POINTER(CompressionInfoType) cinfo = OPENJPEG.opj_create_...
python
def create_compress(fmt): """Wrapper for openjpeg library function opj_create_compress. Creates a J2K/JPT/JP2 compression structure. """ OPENJPEG.opj_create_compress.argtypes = [ctypes.c_int] OPENJPEG.opj_create_compress.restype = ctypes.POINTER(CompressionInfoType) cinfo = OPENJPEG.opj_create_...
Wrapper for openjpeg library function opj_create_compress. Creates a J2K/JPT/JP2 compression structure.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L456-L464
quintusdias/glymur
glymur/lib/openjpeg.py
create_decompress
def create_decompress(fmt): """Wraps openjpeg library function opj_create_decompress. """ OPENJPEG.opj_create_decompress.argtypes = [ctypes.c_int] restype = ctypes.POINTER(DecompressionInfoType) OPENJPEG.opj_create_decompress.restype = restype dinfo = OPENJPEG.opj_create_decompress(fmt) retu...
python
def create_decompress(fmt): """Wraps openjpeg library function opj_create_decompress. """ OPENJPEG.opj_create_decompress.argtypes = [ctypes.c_int] restype = ctypes.POINTER(DecompressionInfoType) OPENJPEG.opj_create_decompress.restype = restype dinfo = OPENJPEG.opj_create_decompress(fmt) retu...
Wraps openjpeg library function opj_create_decompress.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L467-L474
quintusdias/glymur
glymur/lib/openjpeg.py
decode
def decode(dinfo, cio): """Wrapper for opj_decode. """ argtypes = [ctypes.POINTER(DecompressionInfoType), ctypes.POINTER(CioType)] OPENJPEG.opj_decode.argtypes = argtypes OPENJPEG.opj_decode.restype = ctypes.POINTER(ImageType) image = OPENJPEG.opj_decode(dinfo, cio) return image
python
def decode(dinfo, cio): """Wrapper for opj_decode. """ argtypes = [ctypes.POINTER(DecompressionInfoType), ctypes.POINTER(CioType)] OPENJPEG.opj_decode.argtypes = argtypes OPENJPEG.opj_decode.restype = ctypes.POINTER(ImageType) image = OPENJPEG.opj_decode(dinfo, cio) return image
Wrapper for opj_decode.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L477-L484
quintusdias/glymur
glymur/lib/openjpeg.py
destroy_compress
def destroy_compress(cinfo): """Wrapper for openjpeg library function opj_destroy_compress. Release resources for a compressor handle. """ argtypes = [ctypes.POINTER(CompressionInfoType)] OPENJPEG.opj_destroy_compress.argtypes = argtypes OPENJPEG.opj_destroy_compress(cinfo)
python
def destroy_compress(cinfo): """Wrapper for openjpeg library function opj_destroy_compress. Release resources for a compressor handle. """ argtypes = [ctypes.POINTER(CompressionInfoType)] OPENJPEG.opj_destroy_compress.argtypes = argtypes OPENJPEG.opj_destroy_compress(cinfo)
Wrapper for openjpeg library function opj_destroy_compress. Release resources for a compressor handle.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L487-L494
quintusdias/glymur
glymur/lib/openjpeg.py
encode
def encode(cinfo, cio, image): """Wrapper for openjpeg library function opj_encode. Encodes an image into a JPEG-2000 codestream. Parameters ---------- cinfo : compression handle cio : output buffer stream image : image to encode """ argtypes = [ctypes.POINTER(CompressionInfoType...
python
def encode(cinfo, cio, image): """Wrapper for openjpeg library function opj_encode. Encodes an image into a JPEG-2000 codestream. Parameters ---------- cinfo : compression handle cio : output buffer stream image : image to encode """ argtypes = [ctypes.POINTER(CompressionInfoType...
Wrapper for openjpeg library function opj_encode. Encodes an image into a JPEG-2000 codestream. Parameters ---------- cinfo : compression handle cio : output buffer stream image : image to encode
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L497-L516
quintusdias/glymur
glymur/lib/openjpeg.py
destroy_decompress
def destroy_decompress(dinfo): """Wraps openjpeg library function opj_destroy_decompress.""" argtypes = [ctypes.POINTER(DecompressionInfoType)] OPENJPEG.opj_destroy_decompress.argtypes = argtypes OPENJPEG.opj_destroy_decompress(dinfo)
python
def destroy_decompress(dinfo): """Wraps openjpeg library function opj_destroy_decompress.""" argtypes = [ctypes.POINTER(DecompressionInfoType)] OPENJPEG.opj_destroy_decompress.argtypes = argtypes OPENJPEG.opj_destroy_decompress(dinfo)
Wraps openjpeg library function opj_destroy_decompress.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L519-L523
quintusdias/glymur
glymur/lib/openjpeg.py
image_create
def image_create(cmptparms, cspace): """Wrapper for openjpeg library function opj_image_create. """ lst = [ctypes.c_int, ctypes.POINTER(ImageComptParmType), ctypes.c_int] OPENJPEG.opj_image_create.argtypes = lst OPENJPEG.opj_image_create.restype = ctypes.POINTER(ImageType) image = OPENJPEG.opj_...
python
def image_create(cmptparms, cspace): """Wrapper for openjpeg library function opj_image_create. """ lst = [ctypes.c_int, ctypes.POINTER(ImageComptParmType), ctypes.c_int] OPENJPEG.opj_image_create.argtypes = lst OPENJPEG.opj_image_create.restype = ctypes.POINTER(ImageType) image = OPENJPEG.opj_...
Wrapper for openjpeg library function opj_image_create.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L526-L534
quintusdias/glymur
glymur/lib/openjpeg.py
image_destroy
def image_destroy(image): """Wraps openjpeg library function opj_image_destroy.""" OPENJPEG.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)] OPENJPEG.opj_image_destroy(image)
python
def image_destroy(image): """Wraps openjpeg library function opj_image_destroy.""" OPENJPEG.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)] OPENJPEG.opj_image_destroy(image)
Wraps openjpeg library function opj_image_destroy.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L537-L540
quintusdias/glymur
glymur/lib/openjpeg.py
set_default_encoder_parameters
def set_default_encoder_parameters(): """Wrapper for openjpeg library function opj_set_default_encoder_parameters. """ cparams = CompressionParametersType() argtypes = [ctypes.POINTER(CompressionParametersType)] OPENJPEG.opj_set_default_encoder_parameters.argtypes = argtypes OPENJPEG.opj_set_def...
python
def set_default_encoder_parameters(): """Wrapper for openjpeg library function opj_set_default_encoder_parameters. """ cparams = CompressionParametersType() argtypes = [ctypes.POINTER(CompressionParametersType)] OPENJPEG.opj_set_default_encoder_parameters.argtypes = argtypes OPENJPEG.opj_set_def...
Wrapper for openjpeg library function opj_set_default_encoder_parameters.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L543-L550
quintusdias/glymur
glymur/lib/openjpeg.py
set_default_decoder_parameters
def set_default_decoder_parameters(dparams_p): """Wrapper for opj_set_default_decoder_parameters. """ argtypes = [ctypes.POINTER(DecompressionParametersType)] OPENJPEG.opj_set_default_decoder_parameters.argtypes = argtypes OPENJPEG.opj_set_default_decoder_parameters(dparams_p)
python
def set_default_decoder_parameters(dparams_p): """Wrapper for opj_set_default_decoder_parameters. """ argtypes = [ctypes.POINTER(DecompressionParametersType)] OPENJPEG.opj_set_default_decoder_parameters.argtypes = argtypes OPENJPEG.opj_set_default_decoder_parameters(dparams_p)
Wrapper for opj_set_default_decoder_parameters.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L553-L558
quintusdias/glymur
glymur/lib/openjpeg.py
set_event_mgr
def set_event_mgr(dinfo, event_mgr, context=None): """Wrapper for openjpeg library function opj_set_event_mgr. """ argtypes = [ctypes.POINTER(CommonStructType), ctypes.POINTER(EventMgrType), ctypes.c_void_p] OPENJPEG.opj_set_event_mgr.argtypes = argtypes OPENJPEG.opj_...
python
def set_event_mgr(dinfo, event_mgr, context=None): """Wrapper for openjpeg library function opj_set_event_mgr. """ argtypes = [ctypes.POINTER(CommonStructType), ctypes.POINTER(EventMgrType), ctypes.c_void_p] OPENJPEG.opj_set_event_mgr.argtypes = argtypes OPENJPEG.opj_...
Wrapper for openjpeg library function opj_set_event_mgr.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L561-L570
quintusdias/glymur
glymur/lib/openjpeg.py
setup_encoder
def setup_encoder(cinfo, cparameters, image): """Wrapper for openjpeg library function opj_setup_decoder.""" argtypes = [ctypes.POINTER(CompressionInfoType), ctypes.POINTER(CompressionParametersType), ctypes.POINTER(ImageType)] OPENJPEG.opj_setup_encoder.argtypes = argtypes ...
python
def setup_encoder(cinfo, cparameters, image): """Wrapper for openjpeg library function opj_setup_decoder.""" argtypes = [ctypes.POINTER(CompressionInfoType), ctypes.POINTER(CompressionParametersType), ctypes.POINTER(ImageType)] OPENJPEG.opj_setup_encoder.argtypes = argtypes ...
Wrapper for openjpeg library function opj_setup_decoder.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L573-L579
quintusdias/glymur
glymur/lib/openjpeg.py
setup_decoder
def setup_decoder(dinfo, dparams): """Wrapper for openjpeg library function opj_setup_decoder.""" argtypes = [ctypes.POINTER(DecompressionInfoType), ctypes.POINTER(DecompressionParametersType)] OPENJPEG.opj_setup_decoder.argtypes = argtypes OPENJPEG.opj_setup_decoder(dinfo, dparams)
python
def setup_decoder(dinfo, dparams): """Wrapper for openjpeg library function opj_setup_decoder.""" argtypes = [ctypes.POINTER(DecompressionInfoType), ctypes.POINTER(DecompressionParametersType)] OPENJPEG.opj_setup_decoder.argtypes = argtypes OPENJPEG.opj_setup_decoder(dinfo, dparams)
Wrapper for openjpeg library function opj_setup_decoder.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L582-L587
openego/ding0
ding0/grid/mv_grid/util/util.py
print_upper_triangular_matrix
def print_upper_triangular_matrix(matrix): """Prints a CVRP data dict matrix Arguments --------- matrix : dict Description Notes ----- It is assummed that the first row of matrix contains all needed headers. """ # Print column header # Assumes first row con...
python
def print_upper_triangular_matrix(matrix): """Prints a CVRP data dict matrix Arguments --------- matrix : dict Description Notes ----- It is assummed that the first row of matrix contains all needed headers. """ # Print column header # Assumes first row con...
Prints a CVRP data dict matrix Arguments --------- matrix : dict Description Notes ----- It is assummed that the first row of matrix contains all needed headers.
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/util.py#L22-L57
openego/ding0
ding0/grid/mv_grid/util/util.py
print_upper_triangular_matrix_as_complete
def print_upper_triangular_matrix_as_complete(matrix): """Prints a CVRP data dict upper triangular matrix as a normal matrix Doesn't print headers. Arguments --------- matrix : dict Description """ for i in sorted(matrix.keys()): for j in sorted(matrix.keys...
python
def print_upper_triangular_matrix_as_complete(matrix): """Prints a CVRP data dict upper triangular matrix as a normal matrix Doesn't print headers. Arguments --------- matrix : dict Description """ for i in sorted(matrix.keys()): for j in sorted(matrix.keys...
Prints a CVRP data dict upper triangular matrix as a normal matrix Doesn't print headers. Arguments --------- matrix : dict Description
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/util.py#L59-L78
openego/ding0
ding0/grid/mv_grid/util/util.py
print_solution
def print_solution(solution): """Prints a solution Arguments --------- solution : BaseSolution Example ------- :: [8, 9, 10, 7]: 160 [5, 6]: 131 [3, 4, 2]: 154 Total cost: 445 """ total_cost = 0 for solution in solution.routes()...
python
def print_solution(solution): """Prints a solution Arguments --------- solution : BaseSolution Example ------- :: [8, 9, 10, 7]: 160 [5, 6]: 131 [3, 4, 2]: 154 Total cost: 445 """ total_cost = 0 for solution in solution.routes()...
Prints a solution Arguments --------- solution : BaseSolution Example ------- :: [8, 9, 10, 7]: 160 [5, 6]: 131 [3, 4, 2]: 154 Total cost: 445
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/util/util.py#L80-L103
openego/ding0
ding0/tools/validation.py
validate_generation
def validate_generation(session, nw): '''Validate if total generation of a grid in a pkl file is what expected. Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw: The network Returns ------- DataFrame compare_by_level...
python
def validate_generation(session, nw): '''Validate if total generation of a grid in a pkl file is what expected. Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw: The network Returns ------- DataFrame compare_by_level...
Validate if total generation of a grid in a pkl file is what expected. Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw: The network Returns ------- DataFrame compare_by_level DataFrame compare_by_type
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/validation.py#L28-L114
openego/ding0
ding0/tools/validation.py
validate_load_areas
def validate_load_areas(session, nw): '''Validate if total load of a grid in a pkl file is what expected from load areas Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw The network Returns ------- DataFrame compare_...
python
def validate_load_areas(session, nw): '''Validate if total load of a grid in a pkl file is what expected from load areas Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw The network Returns ------- DataFrame compare_...
Validate if total load of a grid in a pkl file is what expected from load areas Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw The network Returns ------- DataFrame compare_by_la Bool True if data base IDs ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/validation.py#L117-L170
openego/ding0
ding0/tools/validation.py
validate_lv_districts
def validate_lv_districts(session, nw): '''Validate if total load of a grid in a pkl file is what expected from LV districts Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw: The network Returns ------- DataFrame compare_by...
python
def validate_lv_districts(session, nw): '''Validate if total load of a grid in a pkl file is what expected from LV districts Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw: The network Returns ------- DataFrame compare_by...
Validate if total load of a grid in a pkl file is what expected from LV districts Parameters ---------- session : sqlalchemy.orm.session.Session Database session nw: The network Returns ------- DataFrame compare_by_district DataFrame compare_by_load...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/validation.py#L174-L294
openego/ding0
ding0/flexopt/check_tech_constraints.py
check_load
def check_load(grid, mode): """ Checks for over-loading of branches and transformers for MV or LV grid. Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :obj:`dict` Dict of critical branches with max...
python
def check_load(grid, mode): """ Checks for over-loading of branches and transformers for MV or LV grid. Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :obj:`dict` Dict of critical branches with max...
Checks for over-loading of branches and transformers for MV or LV grid. Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :obj:`dict` Dict of critical branches with max. relative overloading, and the ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L31-L152
openego/ding0
ding0/flexopt/check_tech_constraints.py
check_voltage
def check_voltage(grid, mode): """ Checks for voltage stability issues at all nodes for MV or LV grid Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :any:`list` of :any:`GridDing0` List of critical...
python
def check_voltage(grid, mode): """ Checks for voltage stability issues at all nodes for MV or LV grid Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :any:`list` of :any:`GridDing0` List of critical...
Checks for voltage stability issues at all nodes for MV or LV grid Parameters ---------- grid : GridDing0 Grid identifier. mode : str Kind of grid ('MV' or 'LV'). Returns ------- :any:`list` of :any:`GridDing0` List of critical nodes, sorted descending by voltage di...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L155-L211
openego/ding0
ding0/flexopt/check_tech_constraints.py
get_critical_line_loading
def get_critical_line_loading(grid): """ Assign line loading to each branch determined by peak load and peak generation of descendant branches The attribute `s_res` is a list of two elements 1. apparent power in load case 2. apparent power in feed-in case Parameters ---------- grid...
python
def get_critical_line_loading(grid): """ Assign line loading to each branch determined by peak load and peak generation of descendant branches The attribute `s_res` is a list of two elements 1. apparent power in load case 2. apparent power in feed-in case Parameters ---------- grid...
Assign line loading to each branch determined by peak load and peak generation of descendant branches The attribute `s_res` is a list of two elements 1. apparent power in load case 2. apparent power in feed-in case Parameters ---------- grid : ding0.core.network.grids.LVGridDing0 D...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L214-L302
openego/ding0
ding0/flexopt/check_tech_constraints.py
peak_load_generation_at_node
def peak_load_generation_at_node(nodes): """ Get maximum occuring load and generation at a certain node Summarizes peak loads and nominal generation power of descendant nodes of a branch Parameters ---------- nodes : :any:`list` Any LV grid Ding0 node object that is part of the gri...
python
def peak_load_generation_at_node(nodes): """ Get maximum occuring load and generation at a certain node Summarizes peak loads and nominal generation power of descendant nodes of a branch Parameters ---------- nodes : :any:`list` Any LV grid Ding0 node object that is part of the gri...
Get maximum occuring load and generation at a certain node Summarizes peak loads and nominal generation power of descendant nodes of a branch Parameters ---------- nodes : :any:`list` Any LV grid Ding0 node object that is part of the grid topology Return ------ :any:`float` ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L305-L333
openego/ding0
ding0/flexopt/check_tech_constraints.py
get_critical_voltage_at_nodes
def get_critical_voltage_at_nodes(grid): r""" Estimate voltage drop/increase induced by loads/generators connected to the grid. Based on voltage level at each node of the grid critical nodes in terms of exceed tolerable voltage drop/increase are determined. The tolerable voltage drop/increase i...
python
def get_critical_voltage_at_nodes(grid): r""" Estimate voltage drop/increase induced by loads/generators connected to the grid. Based on voltage level at each node of the grid critical nodes in terms of exceed tolerable voltage drop/increase are determined. The tolerable voltage drop/increase i...
r""" Estimate voltage drop/increase induced by loads/generators connected to the grid. Based on voltage level at each node of the grid critical nodes in terms of exceed tolerable voltage drop/increase are determined. The tolerable voltage drop/increase is defined by [#VDE]_ a adds up to 3 % of ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L336-L526
openego/ding0
ding0/flexopt/check_tech_constraints.py
voltage_delta_vde
def voltage_delta_vde(v_nom, s_max, r, x, cos_phi): """ Estimate voltrage drop/increase The VDE [#]_ proposes a simplified method to estimate voltage drop or increase in radial grids. Parameters ---------- v_nom : int Nominal voltage s_max : float Apparent power r :...
python
def voltage_delta_vde(v_nom, s_max, r, x, cos_phi): """ Estimate voltrage drop/increase The VDE [#]_ proposes a simplified method to estimate voltage drop or increase in radial grids. Parameters ---------- v_nom : int Nominal voltage s_max : float Apparent power r :...
Estimate voltrage drop/increase The VDE [#]_ proposes a simplified method to estimate voltage drop or increase in radial grids. Parameters ---------- v_nom : int Nominal voltage s_max : float Apparent power r : float Short-circuit resistance from node to HV/MV subst...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L529-L564
openego/ding0
ding0/flexopt/check_tech_constraints.py
get_house_conn_gen_load
def get_house_conn_gen_load(graph, node): """ Get generation capacity/ peak load of neighboring house connected to main branch Parameters ---------- graph : :networkx:`NetworkX Graph Obj< >` Directed graph node : graph node Node of the main branch of LV grid Returns ...
python
def get_house_conn_gen_load(graph, node): """ Get generation capacity/ peak load of neighboring house connected to main branch Parameters ---------- graph : :networkx:`NetworkX Graph Obj< >` Directed graph node : graph node Node of the main branch of LV grid Returns ...
Get generation capacity/ peak load of neighboring house connected to main branch Parameters ---------- graph : :networkx:`NetworkX Graph Obj< >` Directed graph node : graph node Node of the main branch of LV grid Returns ------- :any:`list` A list containing two...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L567-L599
openego/ding0
ding0/flexopt/check_tech_constraints.py
get_voltage_delta_branch
def get_voltage_delta_branch(grid, tree, node, r_preceeding, x_preceeding): """ Determine voltage for a preceeding branch (edge) of node Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology node : graph nod...
python
def get_voltage_delta_branch(grid, tree, node, r_preceeding, x_preceeding): """ Determine voltage for a preceeding branch (edge) of node Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology node : graph nod...
Determine voltage for a preceeding branch (edge) of node Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology node : graph node Node to determine voltage level at r_preceeding : float Resitance ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L602-L648
openego/ding0
ding0/flexopt/check_tech_constraints.py
get_mv_impedance
def get_mv_impedance(grid): """ Determine MV grid impedance (resistance and reactance separately) Parameters ---------- grid : LVGridDing0 Returns ------- :any:`list` List containing resistance and reactance of MV grid """ omega = 2 * math.pi * 50 mv_grid = grid.g...
python
def get_mv_impedance(grid): """ Determine MV grid impedance (resistance and reactance separately) Parameters ---------- grid : LVGridDing0 Returns ------- :any:`list` List containing resistance and reactance of MV grid """ omega = 2 * math.pi * 50 mv_grid = grid.g...
Determine MV grid impedance (resistance and reactance separately) Parameters ---------- grid : LVGridDing0 Returns ------- :any:`list` List containing resistance and reactance of MV grid
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L651-L674
openego/ding0
ding0/flexopt/check_tech_constraints.py
voltage_delta_stub
def voltage_delta_stub(grid, tree, main_branch_node, stub_node, r_preceeding, x_preceedig): """ Determine voltage for stub branches Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology ...
python
def voltage_delta_stub(grid, tree, main_branch_node, stub_node, r_preceeding, x_preceedig): """ Determine voltage for stub branches Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology ...
Determine voltage for stub branches Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology main_branch_node : graph node Node of main branch that stub branch node in connected to main_branch : dict ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L677-L733
openego/ding0
ding0/flexopt/check_tech_constraints.py
get_voltage_at_bus_bar
def get_voltage_at_bus_bar(grid, tree): """ Determine voltage level at bus bar of MV-LV substation Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology: Returns ------- :any:`list` Voltage ...
python
def get_voltage_at_bus_bar(grid, tree): """ Determine voltage level at bus bar of MV-LV substation Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology: Returns ------- :any:`list` Voltage ...
Determine voltage level at bus bar of MV-LV substation Parameters ---------- grid : LVGridDing0 Ding0 grid object tree : :networkx:`NetworkX Graph Obj< >` Tree of grid topology: Returns ------- :any:`list` Voltage at bus bar. First item refers to load case, second i...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/flexopt/check_tech_constraints.py#L736-L783
openego/ding0
ding0/core/structure/groups.py
LoadAreaGroupDing0.add_lv_load_area
def add_lv_load_area(self, lv_load_area): # TODO: check docstring """Adds a LV load_area to _lv_load_areas if not already existing Args ---- lv_load_area: :shapely:`Shapely Polygon object<polygons>` Descr """ self._lv_load_areas.append(lv_load...
python
def add_lv_load_area(self, lv_load_area): # TODO: check docstring """Adds a LV load_area to _lv_load_areas if not already existing Args ---- lv_load_area: :shapely:`Shapely Polygon object<polygons>` Descr """ self._lv_load_areas.append(lv_load...
Adds a LV load_area to _lv_load_areas if not already existing Args ---- lv_load_area: :shapely:`Shapely Polygon object<polygons>` Descr
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/groups.py#L68-L79
openego/ding0
ding0/core/structure/groups.py
LoadAreaGroupDing0.can_add_lv_load_area
def can_add_lv_load_area(self, node): # TODO: check docstring """Sums up peak load of LV stations That is, total peak load for satellite string Args ---- node: GridDing0 Descr Returns ------- bool ...
python
def can_add_lv_load_area(self, node): # TODO: check docstring """Sums up peak load of LV stations That is, total peak load for satellite string Args ---- node: GridDing0 Descr Returns ------- bool ...
Sums up peak load of LV stations That is, total peak load for satellite string Args ---- node: GridDing0 Descr Returns ------- bool True if ????
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/structure/groups.py#L81-L108
openego/ding0
ding0/grid/mv_grid/solvers/local_search.py
LocalSearchSolver.operator_oropt
def operator_oropt(self, graph, solution, op_diff_round_digits, anim=None): # TODO: check docstring """Applies Or-Opt intra-route operator to solution Takes chains of nodes (length=3..1 consecutive nodes) from a given route and calculates savings when inserted into another posit...
python
def operator_oropt(self, graph, solution, op_diff_round_digits, anim=None): # TODO: check docstring """Applies Or-Opt intra-route operator to solution Takes chains of nodes (length=3..1 consecutive nodes) from a given route and calculates savings when inserted into another posit...
Applies Or-Opt intra-route operator to solution Takes chains of nodes (length=3..1 consecutive nodes) from a given route and calculates savings when inserted into another position on the same route (all possible positions). Performes best move (max. saving) and starts over again...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/local_search.py#L112-L219
openego/ding0
ding0/grid/mv_grid/solvers/local_search.py
LocalSearchSolver.operator_relocate
def operator_relocate(self, graph, solution, op_diff_round_digits, anim): """applies Relocate inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at position with m...
python
def operator_relocate(self, graph, solution, op_diff_round_digits, anim): """applies Relocate inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at position with m...
applies Relocate inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at position with max. saving and procedure starts over again with newly created graph as input....
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/local_search.py#L221-L330
openego/ding0
ding0/grid/mv_grid/solvers/local_search.py
LocalSearchSolver.operator_cross
def operator_cross(self, graph, solution, op_diff_round_digits): # TODO: check docstring """applies Cross inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at pos...
python
def operator_cross(self, graph, solution, op_diff_round_digits): # TODO: check docstring """applies Cross inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at pos...
applies Cross inter-route operator to solution Takes every node from every route and calculates savings when inserted into all possible positions in other routes. Insertion is done at position with max. saving and procedure starts over again with newly created graph as input. Stops when...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/local_search.py#L468-L507
openego/ding0
ding0/grid/mv_grid/solvers/local_search.py
LocalSearchSolver.benchmark_operator_order
def benchmark_operator_order(self, graph, solution, op_diff_round_digits): """performs all possible permutations of route improvement and prints graph length Args ---- graph: :networkx:`NetworkX Graph Obj< >` A NetworkX graaph is used. solution: BaseSolution ...
python
def benchmark_operator_order(self, graph, solution, op_diff_round_digits): """performs all possible permutations of route improvement and prints graph length Args ---- graph: :networkx:`NetworkX Graph Obj< >` A NetworkX graaph is used. solution: BaseSolution ...
performs all possible permutations of route improvement and prints graph length Args ---- graph: :networkx:`NetworkX Graph Obj< >` A NetworkX graaph is used. solution: BaseSolution BaseSolution instance op_diff_round_digits: float Prec...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/local_search.py#L509-L543
openego/ding0
ding0/grid/mv_grid/solvers/local_search.py
LocalSearchSolver.solve
def solve(self, graph, savings_solution, timeout, debug=False, anim=None): """Improve initial savings solution using local search Parameters ---------- graph: :networkx:`NetworkX Graph Obj< >` Graph instance savings_solution: SavingsSolution initial solut...
python
def solve(self, graph, savings_solution, timeout, debug=False, anim=None): """Improve initial savings solution using local search Parameters ---------- graph: :networkx:`NetworkX Graph Obj< >` Graph instance savings_solution: SavingsSolution initial solut...
Improve initial savings solution using local search Parameters ---------- graph: :networkx:`NetworkX Graph Obj< >` Graph instance savings_solution: SavingsSolution initial solution of CVRP problem (instance of `SavingsSolution` class) timeout: int ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/mv_grid/solvers/local_search.py#L545-L600
openego/ding0
ding0/grid/lv_grid/check.py
get_branches
def get_branches(grid): """ Individual graphs of sectoral loads :param geid: :return: """ station = grid._station tree = nx.dfs_tree(grid._graph, station) # TODO: idea # 1. build tree from lv_grid station as root -> diretions should point to # descending leafs # 2. for an...
python
def get_branches(grid): """ Individual graphs of sectoral loads :param geid: :return: """ station = grid._station tree = nx.dfs_tree(grid._graph, station) # TODO: idea # 1. build tree from lv_grid station as root -> diretions should point to # descending leafs # 2. for an...
Individual graphs of sectoral loads :param geid: :return:
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/grid/lv_grid/check.py#L22-L64
openego/ding0
ding0/core/__init__.py
NetworkDing0.add_mv_grid_district
def add_mv_grid_district(self, mv_grid_district): """Adds a MV grid_district to _mv_grid_districts if not already existing""" # TODO: use setter method here (make attribute '_mv_grid_districts' private) if mv_grid_district not in self.mv_grid_districts(): self._mv_grid_districts.appe...
python
def add_mv_grid_district(self, mv_grid_district): """Adds a MV grid_district to _mv_grid_districts if not already existing""" # TODO: use setter method here (make attribute '_mv_grid_districts' private) if mv_grid_district not in self.mv_grid_districts(): self._mv_grid_districts.appe...
Adds a MV grid_district to _mv_grid_districts if not already existing
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L80-L84
openego/ding0
ding0/core/__init__.py
NetworkDing0.run_ding0
def run_ding0(self, session, mv_grid_districts_no=None, debug=False, export_figures=False): """ Let DING0 run by shouting at this method (or just call it from NetworkDing0 instance). This method is a wrapper for the main functionality of DING0. Parameters ---------- ...
python
def run_ding0(self, session, mv_grid_districts_no=None, debug=False, export_figures=False): """ Let DING0 run by shouting at this method (or just call it from NetworkDing0 instance). This method is a wrapper for the main functionality of DING0. Parameters ---------- ...
Let DING0 run by shouting at this method (or just call it from NetworkDing0 instance). This method is a wrapper for the main functionality of DING0. Parameters ---------- session : sqlalchemy.orm.session.Session Database session mv_grid_districts_no :...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L106-L268
openego/ding0
ding0/core/__init__.py
NetworkDing0.get_mvgd_lvla_lvgd_obj_from_id
def get_mvgd_lvla_lvgd_obj_from_id(self): """ Build dict with mapping from LVLoadAreaDing0 id to LVLoadAreaDing0 object, MVGridDistrictDing0 id to MVGridDistrictDing0 object, LVGridDistrictDing0 id to LVGridDistrictDing0 object an...
python
def get_mvgd_lvla_lvgd_obj_from_id(self): """ Build dict with mapping from LVLoadAreaDing0 id to LVLoadAreaDing0 object, MVGridDistrictDing0 id to MVGridDistrictDing0 object, LVGridDistrictDing0 id to LVGridDistrictDing0 object an...
Build dict with mapping from LVLoadAreaDing0 id to LVLoadAreaDing0 object, MVGridDistrictDing0 id to MVGridDistrictDing0 object, LVGridDistrictDing0 id to LVGridDistrictDing0 object and LVStationDi...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L270-L325
openego/ding0
ding0/core/__init__.py
NetworkDing0.build_mv_grid_district
def build_mv_grid_district(self, poly_id, subst_id, grid_district_geo_data, station_geo_data): """Initiates single MV grid_district including station and grid Parameters ---------- poly_id: int ID of grid_district according to database table. Also use...
python
def build_mv_grid_district(self, poly_id, subst_id, grid_district_geo_data, station_geo_data): """Initiates single MV grid_district including station and grid Parameters ---------- poly_id: int ID of grid_district according to database table. Also use...
Initiates single MV grid_district including station and grid Parameters ---------- poly_id: int ID of grid_district according to database table. Also used as ID for created grid #TODO: check type subst_id: int ID of station according to database table #TODO: chec...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L327-L362
openego/ding0
ding0/core/__init__.py
NetworkDing0.build_lv_grid_district
def build_lv_grid_district(self, lv_load_area, lv_grid_districts, lv_stations): """Instantiates and associates lv_grid_district incl grid and station. The instantiation creates more or less empty object...
python
def build_lv_grid_district(self, lv_load_area, lv_grid_districts, lv_stations): """Instantiates and associates lv_grid_district incl grid and station. The instantiation creates more or less empty object...
Instantiates and associates lv_grid_district incl grid and station. The instantiation creates more or less empty objects including relevant data for transformer choice and grid creation Parameters ---------- lv_load_area: :shapely:`Shapely Polygon object<polygons>` ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L364-L469
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_mv_grid_districts
def import_mv_grid_districts(self, session, mv_grid_districts_no=None): """ Imports MV Grid Districts, HV-MV stations, Load Areas, LV Grid Districts and MV-LV stations, instantiates and initiates objects. Parameters ---------- session : sqlalchemy.orm.session.Session ...
python
def import_mv_grid_districts(self, session, mv_grid_districts_no=None): """ Imports MV Grid Districts, HV-MV stations, Load Areas, LV Grid Districts and MV-LV stations, instantiates and initiates objects. Parameters ---------- session : sqlalchemy.orm.session.Session ...
Imports MV Grid Districts, HV-MV stations, Load Areas, LV Grid Districts and MV-LV stations, instantiates and initiates objects. Parameters ---------- session : sqlalchemy.orm.session.Session Database session mv_grid_districts : List of MV grid_districts/stations...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L471-L554
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_lv_load_areas
def import_lv_load_areas(self, session, mv_grid_district, lv_grid_districts, lv_stations): """Imports load_areas (load areas) from database for a single MV grid_district Parameters ---------- session : sqlalchemy.orm.session.Session Database sess...
python
def import_lv_load_areas(self, session, mv_grid_district, lv_grid_districts, lv_stations): """Imports load_areas (load areas) from database for a single MV grid_district Parameters ---------- session : sqlalchemy.orm.session.Session Database sess...
Imports load_areas (load areas) from database for a single MV grid_district Parameters ---------- session : sqlalchemy.orm.session.Session Database session mv_grid_district : MV grid_district/station (instance of MVGridDistrictDing0 class) for which the import of...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L556-L664
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_lv_grid_districts
def import_lv_grid_districts(self, session, lv_stations): """Imports all lv grid districts within given load area Parameters ---------- session : sqlalchemy.orm.session.Session Database session Returns ------- lv_grid_districts: :pandas:`pandas.DataF...
python
def import_lv_grid_districts(self, session, lv_stations): """Imports all lv grid districts within given load area Parameters ---------- session : sqlalchemy.orm.session.Session Database session Returns ------- lv_grid_districts: :pandas:`pandas.DataF...
Imports all lv grid districts within given load area Parameters ---------- session : sqlalchemy.orm.session.Session Database session Returns ------- lv_grid_districts: :pandas:`pandas.DataFrame<dataframe>` Table of lv_grid_districts
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L666-L745
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_lv_stations
def import_lv_stations(self, session): """ Import lv_stations within the given load_area Parameters ---------- session : sqlalchemy.orm.session.Session Database session Returns ------- lv_stations: :pandas:`pandas.DataFrame<dataframe>` ...
python
def import_lv_stations(self, session): """ Import lv_stations within the given load_area Parameters ---------- session : sqlalchemy.orm.session.Session Database session Returns ------- lv_stations: :pandas:`pandas.DataFrame<dataframe>` ...
Import lv_stations within the given load_area Parameters ---------- session : sqlalchemy.orm.session.Session Database session Returns ------- lv_stations: :pandas:`pandas.DataFrame<dataframe>` Table of lv_stations
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L747-L779
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_generators
def import_generators(self, session, debug=False): """ Imports renewable (res) and conventional (conv) generators Args: session : sqlalchemy.orm.session.Session Database session debug: If True, information is printed during process Notes: ...
python
def import_generators(self, session, debug=False): """ Imports renewable (res) and conventional (conv) generators Args: session : sqlalchemy.orm.session.Session Database session debug: If True, information is printed during process Notes: ...
Imports renewable (res) and conventional (conv) generators Args: session : sqlalchemy.orm.session.Session Database session debug: If True, information is printed during process Notes: Connection of generators is done later on in NetworkDing0's method ...
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L781-L985
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_config
def import_config(self): """ Loads parameters from config files Returns ------- int config object #TODO check type """ # load parameters from configs cfg_ding0.load_config('config_db_tables.cfg') cfg_ding0.load_config('config_calc.cfg') ...
python
def import_config(self): """ Loads parameters from config files Returns ------- int config object #TODO check type """ # load parameters from configs cfg_ding0.load_config('config_db_tables.cfg') cfg_ding0.load_config('config_calc.cfg') ...
Loads parameters from config files Returns ------- int config object #TODO check type
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L987-L1004
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_pf_config
def import_pf_config(self): """ Creates power flow config class and imports config from file Returns ------- PFConfigDing0 PFConfigDing0 object """ scenario = cfg_ding0.get("powerflow", "test_grid_stability_scenario") start_hour = int(cfg_ding0.get("...
python
def import_pf_config(self): """ Creates power flow config class and imports config from file Returns ------- PFConfigDing0 PFConfigDing0 object """ scenario = cfg_ding0.get("powerflow", "test_grid_stability_scenario") start_hour = int(cfg_ding0.get("...
Creates power flow config class and imports config from file Returns ------- PFConfigDing0 PFConfigDing0 object
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1006-L1027
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_static_data
def import_static_data(self): """ Imports static data into NetworkDing0 such as equipment. Returns ------- Dictionary with equipment data """ package_path = ding0.__path__[0] static_data = {} equipment_mv_parameters_trafos = cfg_ding0.get('equipment', ...
python
def import_static_data(self): """ Imports static data into NetworkDing0 such as equipment. Returns ------- Dictionary with equipment data """ package_path = ding0.__path__[0] static_data = {} equipment_mv_parameters_trafos = cfg_ding0.get('equipment', ...
Imports static data into NetworkDing0 such as equipment. Returns ------- Dictionary with equipment data
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1029-L1121
openego/ding0
ding0/core/__init__.py
NetworkDing0.import_orm
def import_orm(self): #TODO: check docstring """ Import ORM classes for oedb access depending on input in config in self.config which is loaded from 'config_db_tables.cfg' Returns ------- int Descr #TODO check type """ orm = {} ...
python
def import_orm(self): #TODO: check docstring """ Import ORM classes for oedb access depending on input in config in self.config which is loaded from 'config_db_tables.cfg' Returns ------- int Descr #TODO check type """ orm = {} ...
Import ORM classes for oedb access depending on input in config in self.config which is loaded from 'config_db_tables.cfg' Returns ------- int Descr #TODO check type
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1123-L1193
openego/ding0
ding0/core/__init__.py
NetworkDing0.validate_grid_districts
def validate_grid_districts(self): #TODO: check docstring """ Tests MV grid districts for validity concerning imported data such as: i) Uno ii) Dos Invalid MV grid districts are subsequently deleted from Network. """ msg_...
python
def validate_grid_districts(self): #TODO: check docstring """ Tests MV grid districts for validity concerning imported data such as: i) Uno ii) Dos Invalid MV grid districts are subsequently deleted from Network. """ msg_...
Tests MV grid districts for validity concerning imported data such as: i) Uno ii) Dos Invalid MV grid districts are subsequently deleted from Network.
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1195-L1229