HPInc / HP-Digital-Microfluidics

HP Digital Microfluidics Software Platform and Libraries
MIT License
2 stars 0 forks source link

Change default index base to 1, use in index expressions #231

Open EvanKirshenbaum opened 5 months ago

EvanKirshenbaum commented 5 months ago

Currently, index base defaults to 0. This is really awkward in expressions like well #0, so I should change it to 1.

Also, the same index base should be used in the INDEX function used in w[n] expressions to get well pads.

Should probably also add a cmd-line argument (--zero-index) that allows you to specify that the scripts you use use it.

Eventually, will probably want to get rid of index base entirely.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Feb 04, 2023 at 2:38 PM PST.
EvanKirshenbaum commented 5 months ago

This issue was referenced by the following commits before migration:

EvanKirshenbaum commented 5 months ago

Also need to do this for pad expressions (lower left should be (1,1)).

And need click traces to take this into account as well.

I might want to bite the bullet and just change the notion throughout the actual code.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Feb 05, 2023 at 10:43 AM PST.
EvanKirshenbaum commented 5 months ago

Working on it a little, I'm coming to the conclusion that this is silly. I'm going to just bite the bullet and get rid of the index base notion and say that counting just starts from one. Having to always go through the Environment means that I'm continually going out of my way to make sure I have access to one, and with Attributes (e.g., number, row) that becomes difficult. And it's unnecessary.

So I'm going to change this to simply say that numbered items, rows, and columns just start numbering from one, and that's the way it is in the MPAM code as well as in the macro language. That way things will print as expected. I'll probably need to add in adapters on the order of well_number(n) to avoid having people indexing directly in the lists, but that's probably a good thing anyway.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Feb 05, 2023 at 5:39 PM PST.
EvanKirshenbaum commented 5 months ago

I think it's all there, now. Things that have lists of subcomponents (e.g., Board.wells, Well.shared_pads) now also have methods that take a number (e.g., Board.well_number(n)).

I also added Board.edge(dir) to give the row or column number of the edge based on the direction (by default, delegating to max_row and its siblings based on the orientation).

I also changed the thermocycling support so that ChannelEndpoints now hold Heaters (actually, TemperatureControls) directly rather than by index into an array.

The hardest thing to do was actually to change all of the magic numbers in the device definitions (and @cumbiem will be checking to make sure I didn't screw up the wombat pin mappings) and the existing macros and tasks. The combinatorial synthesis task appears to work, so I'm reasonably confident.

Migrated from internal repository. Originally created by @EvanKirshenbaum on Feb 06, 2023 at 11:35 AM PST.