# Oxford Instruments Power Supply 120-10 for superconducting magnets

class pymeasure.instruments.oxfordinstruments.PS120_10(adapter, name='Oxford PS', **kwargs)

  Bases: `IPS120_10`

  Represents the Oxford Superconducting Magnet Power Supply PS 120-10.

      ps = PS120_10("GPIB::25")   # Default channel for the IPS

      ps.enable_control()         # Enables the power supply and remote control

      ps.train_magnet([           # Train the magnet after it has been cooled-down
          (11.8, 1.0),
          (13.9, 0.4),
          (14.9, 0.2),
          (16.0, 0.1),
      ])

      ps.set_field(12)            # Bring the magnet to 12 T. The switch heater will
                                  # be turned off when the field is reached and the
                                  # current is ramped back to 0 (i.e. persistent mode).

      print(self.field)           # Print the current field (whether in persistent or
                                  # non-persistent mode)

      ps.set_field(0)             # Bring the magnet to 0 T. The persistent mode will be
                                  # turned off first (i.e. current back to set-point and
                                  # switch-heater on); afterwards the switch-heater will
                                  # again be turned off.

      ps.disable_control()        # Disables the control of the supply, turns off the
                                  # switch-heater and clamps the output.

  Parameters:

    - clear_buffer – A boolean property that controls whether the instrument buffer is clear upon initialisation.

    - switch_heater_heating_delay – The time in seconds (default is 20s) to wait after the switch-heater is turned on before the heater is expected to be heated.

    - switch_heater_cooling_delay – The time in seconds (default is 20s) to wait after the switch-heater is turned off before the heater is expected to be cooled down.

    - field_range – A numeric value or a tuple of two values to indicate the lowest and highest allowed magnetic fields. If a numeric value is provided the range is expected to be from `-field_range` to `+field_range`.

class pymeasure.instruments.oxfordinstruments.ips120_10.MagnetError

  Bases: `ValueError`

  Exception that is raised for issues regarding the state of the magnet or power supply.

class pymeasure.instruments.oxfordinstruments.ips120_10.SwitchHeaterError

  Bases: `ValueError`

  Exception that is raised for issues regarding the state of the superconducting switch.