Пример #1
0
 def start_frame2ttl_test(data_file, lengths_file, harp=False):
     here = os.getcwd()
     bns = ph.get_bonsai_path()
     stim_folder = str(
         Path(ph.get_iblrig_folder()) / 'visual_stim' / 'f2ttl_calibration'
     )
     wkfl = os.path.join(stim_folder, 'screen_60Hz.bonsai')
     # Flags
     noedit = '--no-editor'  # implies start and no-debug?
     noboot = '--no-boot'
     data_file_name = "-p:FileNameData=" + str(data_file)
     lengths_file_name = "-p:FileNameDataLengths=" + str(lengths_file)
     if harp:
         harp_file_name = "-p:FileName=" + str(data_file.parent / 'harp_ts_data.csv')
     # Properties
     log.info('Starting pulses @ 60Hz')
     sys.stdout.flush()
     os.chdir(stim_folder)
     if harp:
         s = subprocess.Popen(
             [bns, wkfl, noboot, noedit, data_file_name, lengths_file_name, harp_file_name]
         )
     else:
         s = subprocess.Popen(
             [bns, wkfl, noboot, noedit, data_file_name, lengths_file_name])
     os.chdir(here)
     return s
Пример #2
0
    def start_passive_visual_stim(save2folder):
        here = os.getcwd()
        bns = ph.get_bonsai_path()
        stim_folder = str(
            Path(ph.get_iblrig_folder()) / "visual_stim" / "passiveChoiceWorld"
        )
        wkfl = os.path.join(stim_folder, "passiveChoiceWorld_passive.bonsai")
        os.chdir(stim_folder)
        # Flags
        noedit = "--no-editor"  # implies start and no-debug?
        noboot = "--no-boot"
        # Properties
        SA0_DueTime = "-p:Stim.SpontaneousActivity0.DueTime=00:10:00"
        RFM_FileName = "-p:Stim.ReceptiveFieldMappingStim.FileNameRFMapStim=" + str(
            Path(save2folder) / "_iblrig_RFMapStim.raw.bin"
        )
        RFM_MappingTime = "-p:Stim.ReceptiveFieldMappingStim.MappingTime=00:05:00"

        cmd = [bns, wkfl, noboot, noedit, SA0_DueTime, RFM_FileName, RFM_MappingTime]

        log.info("Starting spontaneous activity and RF mapping stims")
        os.chdir(stim_folder)
        s = subprocess.run(cmd, stdout=subprocess.PIPE)  # locking call
        os.chdir(here)
        log.info("Done")
        sys.stdout.flush()
        return s
Пример #3
0
 def start_screen_color():
     here = os.getcwd()
     iblrig_folder_path = Path(ph.get_iblrig_folder())
     os.chdir(str(iblrig_folder_path / "visual_stim" / "f2ttl_calibration"))
     bns = ph.get_bonsai_path()
     wrkfl = str(iblrig_folder_path / "visual_stim" / "f2ttl_calibration" /
                 "screen_color.bonsai")
     noedit = "--no-editor"  # implies start
     # nodebug = '--start-no-debug'
     # start = '--start'
     noboot = "--no-boot"
     editor = noedit
     subprocess.Popen([bns, wrkfl, editor, noboot])
     time.sleep(3)
     os.chdir(here)
# r = "/home/nico/Projects/IBL/github/iblrig"
# task_settings.IBLRIG_FOLDER = r
# d = ("/home/nico/Projects/IBL/github/iblrig/scratch/" +
#      "test_iblrig_data")
# task_settings.IBLRIG_DATA_FOLDER = d

sph = SessionParamHandler(task_settings, user_settings)

server = Path(sph.IBLRIG_FOLDER
              ) / "visual_stim" / "screen_calibration" / "photodiode_server.py"
# Start the frame2TTL server
# server_cmd = ['python', server, sph.PARAMS['COM_F2TTL']]
# server = subprocess.Popen(server_cmd, stdout=subprocess.PIPE)
# print(server)

bns = get_bonsai_path()
# Path(sph.IBLRIG_FOLDER) / "Bonsai" / "Bonsai64.exe"
# if not bns.exists():
#     bns = Path(sph.IBLRIG_FOLDER) / "Bonsai" / "Bonsai.exe"
wrkfl = Path(sph.IBLRIG_FOLDER
             ) / "visual_stim" / "screen_calibration" / "screen_sweep.bonsai"
noedit = "--no-editor"  # implies start
nodebug = "--start-no-debug"
start = "--start"
editor = nodebug
# Properties
save = "-p:Save=True"
fname = "-p:FileName={sph}_iblrig_calibration_screen_brightness.raw.ssv"
rgb = "-p:RGB=RGB"

cmd = [bns, wrkfl, editor, save, fname, rgb]