jckantor / TCLab

Software support for the Temperature Control Laboratory.
Apache License 2.0
13 stars 22 forks source link

Why are Q1 and Q2 not properties? #108

Closed billtubbs closed 5 years ago

billtubbs commented 5 years ago

Is there a reason why the Q1 and Q2 attributes were not set up as straight-forward properties?

I was expecting something like this:

    @property
    def Q1(self):
        """Get TCLab heater power Q1."""
        return self.send_and_receive('R1', float)

    @Q1.setter
    def Q1(self, val):
        """Set TCLab heater power Q1 (limited to 0-100)."""
        msg = command('Q1', clip(val))
        self.send_and_receive(msg, float)

Then setting/getting would be more intuitive I think:

tcl = tclab.TCLab()
tcl.Q1 = 100
print(tcl.Q1)

Maybe it's too late to change this now. If so, no worries.

alchemyst commented 5 years ago

The reason for this is/was actually to maintain parity with the Matlab interface. If you'd prefer to interact with properties, you can use U1 and U2.

billtubbs commented 5 years ago

Oh I see, that makes sense. Thanks, I will use U1 and U2.