import pkg_resources
pkg_resources.require('aphla')
import aphla as ap
# Other stuff
from cothread.catools import caget, caput, ca_nothing

# Load the machine
ap.machines.load('SRI21')

# First task
BPMS = ap.getElements('BPM')
print('There are {} BPM elements in the machine.'.format(len(BPMS)))

# Second task
print('A list of all the PV names for all BPMS')
for BPM in range(len(BPMS)):
 #   print(BPMS[BPM].pv())
    print caget(BPMS[BPM].pv())

# Third task
QUADS = ap.getElements('QUAD')

print('String values for the setpoint currents')
#for QUAD in range(len(QUADS)):
#    print(caget(QUADS[QUAD].pv(handle='readback')))

import pkg_resources
pkg_resources.require('aphla')
import aphla as ap
# Other stuff
from cothread.catools import caget, caput, ca_nothing

# Load the machine
ap.machines.load('SRI21')

# First task
BPMS = ap.getElements('BPM')
print('There are {} BPM elements in the machine.'.format(len(BPMS)))

# Second task
print('A list of all the PV names for all BPMS')
for BPM in range(len(BPMS)):
    pvs = BPMS[BPM].pv()
    print('PV names: {}  PV values: {}'.format(pvs, caget(pvs)))

# Third task
QUADS = ap.getElements('QUAD')

print('String values for the setpoint currents')
#for QUAD in range(len(QUADS)):
#    print(caget(QUADS[QUAD].pv(handle='readback')))

Make the difference between PV names and values clearer.
Make the difference between PV names and values clearer.

  import pkg_resources
  pkg_resources.require('aphla')
  import aphla as ap
  # Other stuff
  from cothread.catools import caget, caput, ca_nothing
  
  # Load the machine
  ap.machines.load('SRI21')
  
  # First task
  BPMS = ap.getElements('BPM')
  print('There are {} BPM elements in the machine.'.format(len(BPMS)))
  
  # Second task
  print('A list of all the PV names for all BPMS')
  for BPM in range(len(BPMS)):
-  #   print(BPMS[BPM].pv())
+     pvs = BPMS[BPM].pv()
-     print caget(BPMS[BPM].pv())
+     print('PV names: {}  PV values: {}'.format(pvs, caget(pvs)))
  
  # Third task
  QUADS = ap.getElements('QUAD')
  
  print('String values for the setpoint currents')
  #for QUAD in range(len(QUADS)):
  #    print(caget(QUADS[QUAD].pv(handle='readback')))
  
Make the difference between PV names and values clearer.
## Code Before:
import pkg_resources
pkg_resources.require('aphla')
import aphla as ap
# Other stuff
from cothread.catools import caget, caput, ca_nothing

# Load the machine
ap.machines.load('SRI21')

# First task
BPMS = ap.getElements('BPM')
print('There are {} BPM elements in the machine.'.format(len(BPMS)))

# Second task
print('A list of all the PV names for all BPMS')
for BPM in range(len(BPMS)):
 #   print(BPMS[BPM].pv())
    print caget(BPMS[BPM].pv())

# Third task
QUADS = ap.getElements('QUAD')

print('String values for the setpoint currents')
#for QUAD in range(len(QUADS)):
#    print(caget(QUADS[QUAD].pv(handle='readback')))

## Instruction:
Make the difference between PV names and values clearer.
## Code After:
import pkg_resources
pkg_resources.require('aphla')
import aphla as ap
# Other stuff
from cothread.catools import caget, caput, ca_nothing

# Load the machine
ap.machines.load('SRI21')

# First task
BPMS = ap.getElements('BPM')
print('There are {} BPM elements in the machine.'.format(len(BPMS)))

# Second task
print('A list of all the PV names for all BPMS')
for BPM in range(len(BPMS)):
    pvs = BPMS[BPM].pv()
    print('PV names: {}  PV values: {}'.format(pvs, caget(pvs)))

# Third task
QUADS = ap.getElements('QUAD')

print('String values for the setpoint currents')
#for QUAD in range(len(QUADS)):
#    print(caget(QUADS[QUAD].pv(handle='readback')))
