You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry, I don't have time to write something thoughtful. I'm going to paste the slack conversation related to this issue because it's better than nothing.
Raphael Cervantes 10:59 AM @ben LaRoque I'm trying to extend SimpleSCPIEntity such that on_get has a custom calibration
from dripline.core import Entity, calibrate, ThrowReply
from dripline.implementations import SimpleSCPIEntity
import logging
from .power_detector_calibration import zx47_50_cal
logger = logging.getLogger(__name__)
__all__ = []
__all__.append("PowerDetectorEntity")
class PowerDetectorEntity(SimpleSCPIEntity):
'''
Entity with power detector calibration
'''
@calibrate([zx47_50_cal])
def on_get(self):
What should go in the body of on_get if it's the same as SimpleSCPIEntity
Raphael Cervantes 11:05 AM
ok. dope
11:05
I was about to just copy what was in SimpleSCPIEntity, which would have been bad OOP
Ben LaRoque 11:07 AM
the first one uses the class method resolution order to find the next on_get implementation, the latter specifically uses the one that is first in the MRO of SimpleSCPIEntity; here those should be the same, but there could be a time when there’s a subtle difference and you care
11:07
(like if you have multiple inheritance)
Raphael Cervantes 11:08 AM
ohhh
11:08
got it
Raphael Cervantes 11:42 AM @ben LaRoque I'm getting a name error when I run this get command with the custom calibration and I don't understand why
2021-08-16T18:38:10[INFO ] dripline.implementations.ethernet_scpi_service(172) -> sync: 'MEASure:VOLTage:DC?\r\n' -> '-7.55700000E-06'
2021-08-16T18:38:10[DEBUG ] dripline.implementations.ethernet_scpi_service(143) -> should return:
-7.55700000E-06
2021-08-16T18:38:10[DEBUG ] dripline.implementations.entity_endpoints(50) -> raw result is: -7.55700000E-06
2021-08-16T18:38:10[DEBUG ] dripline.core.calibrate(30) -> attempting to calibrate
2021-08-16T18:38:10[DEBUG ] dripline.core.calibrate(43) -> formatted cal is:
zx47_50_cal(-7.55700000E-06)
NameError
zx47_50_cal(-7.55700000E-06)
name 'zx47_50_cal' is not defined
this is where the calibration function is defined: https://github.com/axiondarkmatterexperiment/dripline-orpheus/blob/ad12b0d05cfff7b[…]/extensions/power_detector_entity/power_detector_calibration.py
this is where it decorates the on_get function: https://github.com/axiondarkmatterexperiment/dripline-orpheus/blob/ad12b0d05cfff7b[…]e5e/dripline/extensions/power_detector_entity/power_detector.py
Raphael Cervantes 12:31 PM
ok I have it working now
12:31
but I couldn't use inheritence
12:32
maybe there's a way to override the calibration decoration from the base class?
Ben LaRoque 12:33 PM
oh… um
12:33
that may be a design problem, would need to think about it (edited)
12:33
(dripline side, not your side)
The text was updated successfully, but these errors were encountered:
Sorry, I don't have time to write something thoughtful. I'm going to paste the slack conversation related to this issue because it's better than nothing.
Raphael Cervantes 10:59 AM
@ben LaRoque I'm trying to extend
SimpleSCPIEntity
such thaton_get
has a custom calibrationWhat should go in the body of
on_get
if it's the same asSimpleSCPIEntity
Ben LaRoque 11:03 AM
ummm:
(edited)
11:04
should be the same as:
Raphael Cervantes 11:05 AM
ok. dope
11:05
I was about to just copy what was in SimpleSCPIEntity, which would have been bad OOP
Ben LaRoque 11:07 AM
the first one uses the class method resolution order to find the next on_get implementation, the latter specifically uses the one that is first in the MRO of SimpleSCPIEntity; here those should be the same, but there could be a time when there’s a subtle difference and you care
11:07
(like if you have multiple inheritance)
Raphael Cervantes 11:08 AM
ohhh
11:08
got it
Raphael Cervantes 11:42 AM
@ben LaRoque I'm getting a name error when I run this get command with the custom calibration and I don't understand why
did I implement this incorrectly?
power_detector_calibration.py
https://github.com/axiondarkmatterexperiment/dripline-orpheus|axiondarkmatterexperiment/dripline-orpheusaxiondarkmatterexperiment/dripline-orpheus | Added by GitHub
power_detector.py
https://github.com/axiondarkmatterexperiment/dripline-orpheus|axiondarkmatterexperiment/dripline-orpheusaxiondarkmatterexperiment/dripline-orpheus | Added by GitHub
Raphael Cervantes 11:59 AM
here is my endpoint definiton:
Raphael Cervantes 12:13 PM
I explicitly defined on_get and have gotten further https://github.com/axiondarkmatterexperiment/dripline-orpheus/blob/95f88fd0ae03363[…]8cd/dripline/extensions/power_detector_entity/power_detector.py
I'm guessing the inheritence caused conflicting calibration decorations?
power_detector.py
@calibrate([zx47_50_cal])
https://github.com/axiondarkmatterexperiment/dripline-orpheus|axiondarkmatterexperiment/dripline-orpheusaxiondarkmatterexperiment/dripline-orpheus | Added by GitHub
Raphael Cervantes 12:31 PM
ok I have it working now
12:31
but I couldn't use inheritence
12:32
maybe there's a way to override the calibration decoration from the base class?
Ben LaRoque 12:33 PM
oh… um
12:33
that may be a design problem, would need to think about it (edited)
12:33
(dripline side, not your side)
The text was updated successfully, but these errors were encountered: