# Set\_by\_frequency() API interface

**URL:** <https://forum.liquidinstruments.com/t/set-by-frequency-api-interface/984>\
**Category:** Software & APIs\
**Created:** [June 30, 2024, 5:01pm UTC](https://forum.liquidinstruments.com/t/set-by-frequency-api-interface/984 "2024-06-30T17:01:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jephwack](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jephwack](https://forum.liquidinstruments.com/u/jephwack)\
**Post date:** [June 30, 2024, 5:01pm UTC](https://forum.liquidinstruments.com/t/set-by-frequency-api-interface/984/1 "2024-06-30T17:01:44Z")

</div>

What is the correct way to indicate in a call to set\_by\_frequency that I would like to deactivate one or more of the components of the controller? In other words, how can I replicate the behavior provided by the GUI when I “grey out” the differentiator, for example?

I have tried using ‘None,’ like so:

> llb.set\_pid\_by\_frequency(channel=1,  
> int\_crossover = intCrossover,  
> int\_saturation = intSaturation,  
> prop\_gain = propGain,  
> diff\_crossover = None,  
> diff\_saturation =None,  
> double\_int\_crossover = None,  
> invert=True)

but the response from the Moku looks like:

> {‘diff\_crossover’: 160000.0,  
> ‘diff\_saturation’: 15.0,  
> ‘double\_int\_crossover’: 310.0,  
> ‘int\_crossover’: 18000.0,  
> ‘int\_saturation’: 40.0,  
> ‘invert’: True,  
> ‘prop\_gain’: 0.0}

which seems to indicate that the differentiator and the double integrator are active. As far as I can tell they are not active, rather it seems the echo provided by the set\_by\_frequency call provides a misleading representation of the current controller state.

How does set\_by\_frequency() treat missing keyword arguments? does it grey them out, or does it leave them how they were before? How can I grey them out? What is the most reliable way to set a controller and be sure that I know exactly what controller is being used?

---

<div class="post-metadata">

**Author:** ![nadia](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.liquidinstruments.com/nadia/32/315_2.png) [@nadia](https://forum.liquidinstruments.com/u/nadia)\
**Post date:** [July 1, 2024, 3:05am UTC](https://forum.liquidinstruments.com/t/set-by-frequency-api-interface/984/2 "2024-07-01T03:05:02Z")

</div>

Hi @jephwack

Apologies for the misleading behavior, the function works as you’d expect; missing values are set to `None` and disabled. But the dictionary returned is confusing. I was able to reproduce this on my end and reported this behavior to the team here.

You can confirm that the settings are correct by calling `llb.summary()` for example:

```auto
from moku.instruments import LaserLockBox
llb = LaserLockBox(IP_ADDRESS)
llb.set_pid_by_frequency(1, prop_gain=0, int_saturation=40, int_crossover=18000, invert=True)
print(llb.summary())
>>> ...
>>> Fast controller: PI controller: proportional gain +0.0 dB, integrator crossover 18.00 kHz, integrator saturation +40.0 dB, invert on
>>> ...
```
