qgym.utils package
Generic utils for the Reinforcement Learning QGym.
- class qgym.utils.GateEncoder[source]
Bases:
objectLearns a set of gates and creates a mapping to integers and back.
- decode_gates(encoded_gates)[source]
Decode integer encoded gate names to the original gate names based on the gates seen in
learn_gates.- Parameters:
- Raises:
TypeError – When an unsupported type is given
- Return type:
- Returns:
Decoded version of encoded_gates. The output structure should resemble the input structure. So a
Mappingwill return aDict, while a singleintwill return astr.
- encode_gates(gates)[source]
Encode the gate names (of type
str) in gates to integers, based on the gates seen inlearn_gates.- Parameters:
gates (
str|Mapping[str,Any] |Sequence[Gate] |set[str] |list[str] |tuple[str,...]) – Gates to encode. The input type determines the return type.- Raises:
TypeError – When an unsupported type is given.
- Return type:
- Returns: Integer encoded version of gates. The output structure should resemble
the input structure. So a
Mappingwill return aDict, while a singlestrwill return anint.
- learn_gates(gates)[source]
Learns the gates names from an
Iterableand creates a mapping from unique gate names to integers and back.
- qgym.utils.visualisation package
- qgym.utils.visualisation.colors module
- qgym.utils.visualisation.typing module
FontFont.boldFont.get_ascent()Font.get_bold()Font.get_descent()Font.get_height()Font.get_italic()Font.get_linesize()Font.get_strikethrough()Font.get_underline()Font.italicFont.metrics()Font.render()Font.set_bold()Font.set_italic()Font.set_script()Font.set_strikethrough()Font.set_underline()Font.size()Font.strikethroughFont.underline
SurfaceSurface.blit()Surface.blits()Surface.convert()Surface.convert_alpha()Surface.copy()Surface.fill()Surface.get_abs_offset()Surface.get_abs_parent()Surface.get_alpha()Surface.get_at()Surface.get_at_mapped()Surface.get_bitsize()Surface.get_blendmode()Surface.get_bounding_rect()Surface.get_buffer()Surface.get_bytesize()Surface.get_clip()Surface.get_colorkey()Surface.get_flags()Surface.get_height()Surface.get_locked()Surface.get_locks()Surface.get_losses()Surface.get_masks()Surface.get_offset()Surface.get_palette()Surface.get_palette_at()Surface.get_parent()Surface.get_pitch()Surface.get_rect()Surface.get_shifts()Surface.get_size()Surface.get_view()Surface.get_width()Surface.lock()Surface.map_rgb()Surface.mustlock()Surface.premul_alpha()Surface.scroll()Surface.set_alpha()Surface.set_at()Surface.set_clip()Surface.set_colorkey()Surface.set_masks()Surface.set_palette()Surface.set_palette_at()Surface.set_shifts()Surface.subsurface()Surface.unlock()Surface.unmap_rgb()
- qgym.utils.visualisation.wrappers module