from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
                                          AreaDetectorFileStoreTIFF,
                                          AreaDetectorFileStoreTIFFSquashing)

# from shutter import sh1

shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1')

pe1 = AreaDetectorFileStoreTIFFSquashing(
    'XF:28IDC-ES:1{Det:PE1}',
    name='pe1',
    stats=[],
    ioc_file_path = 'H:/pe1_data',
    file_path = '/home/xf28id1/pe1_data',
    shutter=shctl1,
    shutter_val=(1, 0)
)


# Dan and Sanjit commented this out in June.

#shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='shctl2')
#pe2 = AreaDetectorFileStoreTIFFSquashing(
#    'XF:28IDC-ES:1{Det:PE2}',
#    name='pe2',
#    stats=[],
#    ioc_file_path = 'G:/pe2_data',
#    file_path = '/home/xf28id1/pe2_data',
#    shutter=shctl2,
#    shutter_val=(1,0))

from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
                                          AreaDetectorFileStoreTIFF,
                                          AreaDetectorFileStoreTIFFSquashing)

# from shutter import sh1

#shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1')
shctl1 = EpicsSignal('XF:28IDC-ES:1{Sh:Exp}Cmd-Cmd', name='shctl1')

pe1 = AreaDetectorFileStoreTIFFSquashing(
    'XF:28IDC-ES:1{Det:PE1}',
    name='pe1',
    stats=[],
    ioc_file_path = 'H:/pe1_data',
    file_path = '/home/xf28id1/pe1_data',
#    shutter=shctl1,
#    shutter_val=(1, 0)
)


# Dan and Sanjit commented this out in June.

#shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='shctl2')
#pe2 = AreaDetectorFileStoreTIFFSquashing(
#    'XF:28IDC-ES:1{Det:PE2}',
#    name='pe2',
#    stats=[],
#    ioc_file_path = 'G:/pe2_data',
#    file_path = '/home/xf28id1/pe2_data',
#    shutter=shctl2,
#    shutter_val=(1,0))

Put shutter control entirely in the user's hands
[CFG] Put shutter control entirely in the user's hands

  from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
                                            AreaDetectorFileStoreTIFF,
                                            AreaDetectorFileStoreTIFFSquashing)
  
  # from shutter import sh1
  
- shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1')
+ #shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1')
+ shctl1 = EpicsSignal('XF:28IDC-ES:1{Sh:Exp}Cmd-Cmd', name='shctl1')
  
  pe1 = AreaDetectorFileStoreTIFFSquashing(
      'XF:28IDC-ES:1{Det:PE1}',
      name='pe1',
      stats=[],
      ioc_file_path = 'H:/pe1_data',
      file_path = '/home/xf28id1/pe1_data',
-     shutter=shctl1,
+ #    shutter=shctl1,
-     shutter_val=(1, 0)
+ #    shutter_val=(1, 0)
  )
  
  
  # Dan and Sanjit commented this out in June.
  
  #shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='shctl2')
  #pe2 = AreaDetectorFileStoreTIFFSquashing(
  #    'XF:28IDC-ES:1{Det:PE2}',
  #    name='pe2',
  #    stats=[],
  #    ioc_file_path = 'G:/pe2_data',
  #    file_path = '/home/xf28id1/pe2_data',
  #    shutter=shctl2,
  #    shutter_val=(1,0))
  
Put shutter control entirely in the user's hands
## Code Before:
from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
                                          AreaDetectorFileStoreTIFF,
                                          AreaDetectorFileStoreTIFFSquashing)

# from shutter import sh1

shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1')

pe1 = AreaDetectorFileStoreTIFFSquashing(
    'XF:28IDC-ES:1{Det:PE1}',
    name='pe1',
    stats=[],
    ioc_file_path = 'H:/pe1_data',
    file_path = '/home/xf28id1/pe1_data',
    shutter=shctl1,
    shutter_val=(1, 0)
)


# Dan and Sanjit commented this out in June.

#shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='shctl2')
#pe2 = AreaDetectorFileStoreTIFFSquashing(
#    'XF:28IDC-ES:1{Det:PE2}',
#    name='pe2',
#    stats=[],
#    ioc_file_path = 'G:/pe2_data',
#    file_path = '/home/xf28id1/pe2_data',
#    shutter=shctl2,
#    shutter_val=(1,0))

## Instruction:
Put shutter control entirely in the user's hands
## Code After:
from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
                                          AreaDetectorFileStoreTIFF,
                                          AreaDetectorFileStoreTIFFSquashing)

# from shutter import sh1

#shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1')
shctl1 = EpicsSignal('XF:28IDC-ES:1{Sh:Exp}Cmd-Cmd', name='shctl1')

pe1 = AreaDetectorFileStoreTIFFSquashing(
    'XF:28IDC-ES:1{Det:PE1}',
    name='pe1',
    stats=[],
    ioc_file_path = 'H:/pe1_data',
    file_path = '/home/xf28id1/pe1_data',
#    shutter=shctl1,
#    shutter_val=(1, 0)
)


# Dan and Sanjit commented this out in June.

#shctl2 = EpicsSignal('XF:28IDC-ES:1{Det:PE2}cam1:ShutterMode', name='shctl2')
#pe2 = AreaDetectorFileStoreTIFFSquashing(
#    'XF:28IDC-ES:1{Det:PE2}',
#    name='pe2',
#    stats=[],
#    ioc_file_path = 'G:/pe2_data',
#    file_path = '/home/xf28id1/pe2_data',
#    shutter=shctl2,
#    shutter_val=(1,0))
