ax = plt.subplot(3, 1, 3) plt.imshow(raster[:, 0, :]) plt.tight_layout() # see what a "traditional" NEMS model looks like nems_modelname = "ozgf.fs100.ch18-ld-sev_dlog-wc.18x2.g-do.2x15-lvl.1-dexp.1_init-basic" xfspec, ctx = load_model_xform(cellid, batch=batch, modelname=nems_modelname) nplt.quickplot(ctx) ex = gui.browse_xform_fit(ctx, xfspec) ## batch, cellid = 308, 'AMT018a-09-1' modelname = 'ozgf.fs100.ch18-ld-sev_dlog-wc.18x4.g-fir.2x15x2-relu.2-wc.2x1-lvl.1-dexp.1_init.tf.rb5-tf.n' xfspec, ctx = fit_model_xform(cellid, batch=batch, modelname=modelname) nplt.quickplot(ctx) ex = gui.browse_xform_fit(ctx, xfspec) ###Plot complexity of model versus how effective it was batch = 308 metric = 'r_test' metric2 = 'n_parms' metric3 = 'se_test' query = "SELECT {0}, {1}, {2}, {3} FROM NarfResults WHERE batch = 308".format( metric, metric2, metric3, 'modelname') results = nd.pd_query(sql=query) group = results.groupby('modelname') mean_rtest = group.mean() mean_rtest.plot(x='n_parms', y='r_test', kind='scatter', yerr='se_test')
log.info("Starting QUEUEID={}".format(queueid)) nd.update_job_start(queueid) log.info("HOSTNAME={}".format(os.environ.get('HOSTNAME', 'unknown'))) if len(sys.argv) < 4: print('syntax: fit_single cellid batch modelname') exit(-1) cellid = sys.argv[1] batch = sys.argv[2] modelname = sys.argv[3] log.info("Running xform_helper.fit_model_xform({0},{1},{2})".format( cellid, batch, modelname)) #savefile = nw.fit_model_xforms_baphy(cellid, batch, modelname, saveInDB=True) savefile = xhelp.fit_model_xform(cellid, batch, modelname, saveInDB=True) log.info("Done with fit.") # Mark completed in the queue. Note that this should happen last thing! # Otherwise the job might still crash after being marked as complete. if db_exists & bool(queueid): nd.update_job_complete(queueid) if 'SLURM_JOB_ID' in os.environ: # need to copy the job log over to the queue log dir log_file_dir = Path.home() / 'job_history' log_file = list( log_file_dir.glob( f'*jobid{os.environ["SLURM_JOB_ID"]}_log.out')) if len(log_file) == 1:
batch = 320 # uncomment cell to analyze #cellid = "NMK003c-02-1" cellid = "NMK020c-29-1" modelname = "psth.fs20.pup-ld-st.pup.fil-tar-psthfr.tar_stategain.S_jk.nf20.p-basic" modelname2 = "psth.fs20.pup-ld-st.pup.fil0-tar-psthfr.tar_stategain.S_jk.nf20.p-basic" browse_results = False #save_file = xhelp.fit_model_xform(cellid, batch, modelname) #xfspec, ctx = xhelp.load_model_xform(cellid, batch, modelname) xfspec, ctx = xhelp.fit_model_xform(cellid, batch, modelname, autoPlot=False, returnModel=True) xfspec2, ctx2 = xhelp.fit_model_xform(cellid, batch, modelname2, autoPlot=False, returnModel=True) modelspec = ctx['modelspec'] modelspec2 = ctx2['modelspec'] val = ctx['val'] r = val['resp'] state_channels = val['state'].chans file_epochs = r.epochs.loc[r.epochs.name.str.startswith("FILE")]
import nems import nems.xform_helper as xhelp modelname = 'ozgf.fs50.ch18.pop-loadpop.cc20-norm-pca.no-popev_wc.18x4R.g-fir.4x12xR-lvl.R-dexp.R_tfinit.n.lr1e3.et3-newtf.n.lr1e4' batch = 322 siteid = 'bbl086b' xf, ctx = xhelp.fit_model_xform(siteid, batch, modelname, returnModel=True)
# 100Hz, no pupil recording_file = "TAR010c.NAT.fs100.ch18.tgz" # MODEL SPEC modelname = 'ld-sev_dlog-wc.18x1.g-fir.1x15-lvl.1-dexp.1_init-basic' # 50Hz, pupil #recording_file = "TAR010c.NAT.fs50.ch18.pup.tgz" # MODEL SPEC #modelname = 'ld-st.pup-tev_dlog-wc.18x1.g-fir.1x15-lvl.1-stategain.2-dexp.1_init.st-basic' recording.get_demo_recordings(name=recording_file) recording_uri = os.path.join(get_setting('NEMS_RECORDINGS_DIR'), recording_file) # run and return xfspec, ctx = fit_model_xform(cellid, batch, modelname, recording_uri=recording_uri, returnModel=True) ex = gui.browse_xform_fit(ctx, xfspec) # run and save to database #saveuri = fit_model_xform(cellid, batch, modelname, recording_uri=recording_uri, saveInDB=True) # load previously saved #xfspec, ctx = load_model_xform(cellid, batch, modelname) #ex = gui.browse_xform_fit(ctx, xfspec)