Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
791a7e1
Initial work of untangling VirtualMux and Address Handlers
clint-lawrence May 29, 2024
ed0604f
Implement map_tree and start on AddressHandler
clint-lawrence May 30, 2024
9384673
minor tweaks and comment updates
clint-lawrence May 31, 2024
5035e36
more typing
clint-lawrence Jun 1, 2024
3bd974a
More annotaions and JigDriver changes
clint-lawrence Jun 3, 2024
5ddeab4
Glue handlers and muxs, typing, comments etc
clint-lawrence Jun 4, 2024
8b94e31
A bunch of random stuff...
clint-lawrence Jun 4, 2024
cebeadf
Stringify 'TreeDef' to avoid if TYPE_CHECKING
clint-lawrence Jun 4, 2024
6a71fd2
Implement a Relay Matrix address handler
clint-lawrence Jun 5, 2024
6a05a7e
Move Relay Matrix address handler to avoid ftdi imports
clint-lawrence Jun 5, 2024
32a97c3
Remove the import that the whole last commit was meant to avoid...
clint-lawrence Jun 5, 2024
8dfffd2
why test locally when you can just push, eh?
clint-lawrence Jun 5, 2024
266431e
fix python 3.12 env
clint-lawrence Jun 6, 2024
44e4223
Merge branch 'master' into jig-mux-refactor
clint-lawrence Jun 6, 2024
6f24ea8
Add some test for VirtulMux
clint-lawrence Jun 11, 2024
12c562c
I think I have a black version mis-match somewhere
clint-lawrence Jun 11, 2024
73691ee
Add a test for VirtualSwitch
clint-lawrence Jun 11, 2024
3d87f63
Change VirtualSwitch to use On/Off
clint-lawrence Jun 11, 2024
1ac5a31
add test for RelayMatrixMux
clint-lawrence Jun 11, 2024
250be7e
Don't allow explicitly defining signal ''
clint-lawrence Jun 12, 2024
28895f7
Don't allow 'default_signal' on VirtualMux
clint-lawrence Jun 12, 2024
d6550aa
A few unrelated changes
clint-lawrence Jun 12, 2024
f4a0db0
Fix a missing type hint
clint-lawrence Jun 12, 2024
16b81e3
Just for Jason...
clint-lawrence Jun 13, 2024
03932d3
Tweak the comments a little bit
clint-lawrence Jun 13, 2024
8caead4
Tidy up some debug functions
clint-lawrence Jun 13, 2024
db289a1
Add VirtualMux.wait_at_least()
clint-lawrence Jun 13, 2024
f464c4e
Add tests for VirtualAddressMap
clint-lawrence Jun 14, 2024
bf50400
Add some notes about ftdi baudrate
clint-lawrence Jun 14, 2024
7917808
Rename signal_output to signal
clint-lawrence Jun 14, 2024
19f95a4
re-organise how we export public symbols
clint-lawrence Jun 19, 2024
bf043da
Implement a check on jig definitions
clint-lawrence Jun 19, 2024
1dbe04d
Add test for JigDriver._validate()
clint-lawrence Jun 19, 2024
ed21cf7
Remove type def signal stuff from the test script.
clint-lawrence Jun 19, 2024
50c89cd
Another crack at AddressHandler init.
clint-lawrence Jun 19, 2024
2860792
Relay matrix should open to switch to the same signal
clint-lawrence Jun 20, 2024
68714b3
fix mypy config
clint-lawrence Jun 20, 2024
056eb5f
Move script.py to examples
clint-lawrence Jun 20, 2024
d8ae041
Move _switching up out of core.
clint-lawrence Jun 20, 2024
0a20ba5
blacken the jig_driver example
clint-lawrence Jun 20, 2024
2add8c8
grammar fix before I get in trouble from Jason
clint-lawrence Jun 20, 2024
5475f76
fix mypy config. Again...
clint-lawrence Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
11 changes: 11 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ exclude = (?x)
)
)
)
warn_unused_configs = True
warn_redundant_casts = True

[mypy-fixate.core.switching]
# Enable strict options for new code
warn_unused_ignores = True
strict_equality = True
extra_checks = True
check_untyped_defs = True
disallow_untyped_calls = True
disallow_incomplete_defs = True
disallow_untyped_defs = True


# mypy will also analyse modules if they are imported by a module - even if they are excluded!
Expand Down
64 changes: 64 additions & 0 deletions script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""
This file is just a test playground that shows how the update jig classes will
fit together.
"""
from dataclasses import dataclass, field
from fixate.core.switching import VirtualMux, JigDriver, MuxGroup, PinValueAddressHandler, VirtualSwitch


class MuxOne(VirtualMux):
pin_list = ("x0", "x1", "x2")
map_list = (
("sig1", "x0"),
("sig2", "x1"),
("sig3", "x2"),
)

class MuxTwo(VirtualMux):
pin_list = ("x3", "x4", "x5")
map_tree = (
"sig4",
"sig5",
"sig6",
(
"sig7",
"sig8",
),
)

class MuxThree(VirtualMux):
pin_list = ("x101", "x123")
map_list = (("", "x101", "x123"),)

class Handler(PinValueAddressHandler):
pin_list = ("x0", "x1", "x2", "x3", "x4", "x5")



# Problem!
# our existing scripts/jig driver, the name of the mux is the
# class of the virtual mux. This scheme below will not allow that
# to work.
# Assuming an existing script with a mux called NewVirtualMux
# 1. Update every reference in the script
# dm.jig.mux.NewVirtualMux -> dm.jig.mux.new_virtual_mux
# 2. Change the class name, but keep the attribute name
# @dataclass
# class JigMuxGroup(MuxGroup):
# NewVirtualMux: _NewVirtualMux
# Then the references in the script stay this same.
# jig.mux.NewVirtualMux
# 3. Change the attribute name on mux, like in the example below,
# but add some compatibility code to MuxGroup base class so that
# attribute lookups that match the Class of one of its attributes
# get magically mapped to the correct attribute.
@dataclass
class JigMuxGroup(MuxGroup):
mux_one: MuxOne = field(default_factory=MuxOne)
mux_two: MuxTwo = field(default_factory=MuxTwo)
mux_three: MuxThree = field(default_factory=MuxThree)

jig = JigDriver(JigMuxGroup, [Handler()])

jig.mux.mux_one("sig2", trigger_update=False)
jig.mux.mux_two("sig5")
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package_dir =
packages = find:
include_package_data = True
zip_safe = False
python_requires = ~=3.7
python_requires = ~=3.8

install_requires =
pyvisa
Expand All @@ -35,8 +35,6 @@ install_requires =
numpy
PyDAQmx
# for typing.protocol
typing_extensions ; python_version < "3.8"
importlib-metadata >= 1.0 ; python_version < "3.8"
platformdirs

[options.packages.find]
Expand Down
Loading