Skip to content

Commit

Permalink
Last commit before updated oneData
Browse files Browse the repository at this point in the history
(empty)
  • Loading branch information
landoskape committed Jun 22, 2023
1 parent b360faa commit 70b7004
Showing 1 changed file with 79 additions and 12 deletions.
91 changes: 79 additions & 12 deletions testingPipelineFunctions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,96 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 4,
"id": "266df662-bc89-4dc4-ad54-58669e96b403",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"mouseName = 'ATL020'\n",
"dateString = '2023-05-04'\n",
"session = '702'"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "3232a21b-e0f7-43c3-99a2-d2b4b67d3530",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"In session: CR_Hippocannula6/2022-09-05/701, vrFile['rigInfo'] does not exist. Assuming default settings for B2!\n",
"In session CR_Hippocannula6/2022-09-05/701, the one file behave.timestamps.npy doesn't exist. Here is a list of saved oneData files:\n",
"lick.timelinesample\n",
"reward.timelinesample\n",
"timeline.rotaryposition\n",
"timeline.timestamps\n",
"trial.starttimes\n"
]
},
{
"ename": "ValueError",
"evalue": "oneData requested is not available",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[8], line 10\u001b[0m\n\u001b[0;32m 8\u001b[0m vrReg\u001b[38;5;241m.\u001b[39mprocessTimeline()\n\u001b[0;32m 9\u001b[0m \u001b[38;5;66;03m# vrReg.processBehavior()\u001b[39;00m\n\u001b[1;32m---> 10\u001b[0m \u001b[43mvrReg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprocessImaging\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 11\u001b[0m vrReg\u001b[38;5;241m.\u001b[39mprocessFacecam()\n",
"File \u001b[1;32m~\\Documents\\GitHub\\vrAnalysis\\vrExperiment.py:500\u001b[0m, in \u001b[0;36mvrExperimentRegistration.processImaging\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 497\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mregisterValue(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msamplingDeviationMaximumPercentError\u001b[39m\u001b[38;5;124m'\u001b[39m,np\u001b[38;5;241m.\u001b[39mexp(np\u001b[38;5;241m.\u001b[39mmax(np\u001b[38;5;241m.\u001b[39mabs(np\u001b[38;5;241m.\u001b[39mlog(np\u001b[38;5;241m.\u001b[39mdiff(frame2time)\u001b[38;5;241m/\u001b[39mnp\u001b[38;5;241m.\u001b[39mmedian(np\u001b[38;5;241m.\u001b[39mdiff(frame2time)))))))\n\u001b[0;32m 499\u001b[0m \u001b[38;5;66;03m# compute translation mapping from behave frames to imaging frames\u001b[39;00m\n\u001b[1;32m--> 500\u001b[0m idxBehaveToFrame,distBehaveToFrame \u001b[38;5;241m=\u001b[39m bf\u001b[38;5;241m.\u001b[39mnearestpoint(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloadone\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mbehave.timestamps\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m, frame2time)\n\u001b[0;32m 502\u001b[0m \u001b[38;5;66;03m# recompute deconvolution if requested\u001b[39;00m\n\u001b[0;32m 503\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mopts[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124moasis\u001b[39m\u001b[38;5;124m'\u001b[39m]:\n",
"File \u001b[1;32m~\\Documents\\GitHub\\vrAnalysis\\vrExperiment.py:97\u001b[0m, in \u001b[0;36mvrExperiment.loadone\u001b[1;34m(self, force, *names)\u001b[0m\n\u001b[0;32m 95\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIn session \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msessionPrint()\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m, the one file \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfileName\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m doesn\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt exist. Here is a list of saved oneData files:\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 96\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m oneFile \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprintSavedOne(): \u001b[38;5;28mprint\u001b[39m(oneFile)\n\u001b[1;32m---> 97\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moneData requested is not available\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 98\u001b[0m oneVar \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mload(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39monePath() \u001b[38;5;241m/\u001b[39m fileName)\n\u001b[0;32m 99\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mloadBuffer[fileName] \u001b[38;5;241m=\u001b[39m oneVar\n",
"\u001b[1;31mValueError\u001b[0m: oneData requested is not available"
]
}
],
"source": [
"mouseName = 'CR_Hippocannula6'\n",
"dateString = '2022-09-05'\n",
"session = '701'\n",
"\n",
"# Test vrRegistration for CR_Hippocannula6\n",
"vrReg = vre.vrExperimentRegistration(mouseName, dateString, session, oasis=False, imaging=True)\n",
"\n",
"vrReg.processTimeline()\n",
"# vrReg.processBehavior()\n",
"vrReg.processImaging()\n",
"vrReg.processFacecam()\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "b546e957-03cd-48ca-98e8-70c1db297f51",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"In session: ATL020/2023-05-04/702, vrFile['rigInfo'] does not exist. Assuming default settings for B2!\n",
"Self.value['numTrials'] set by trialInfo.trialIdx>0, but this might not be right. There might be smarter ways to determine which trials are 'good' trials...\n",
"frameSamples had 2 more than suite2p output. This happens sometimes. I don't like it. I think it's because scanimage sends a TTL before starting the frame\n",
"Facecam preprocessing has not been coded yet!\n",
"C:\\Users\\andrew\\Documents\\localData\\ATL020\\2023-05-04\\702\n"
"In session: CR_Hippocannula6/2022-09-05/701, vrFile['rigInfo'] does not exist. Assuming default settings for B2!\n"
]
},
{
"ename": "KeyError",
"evalue": "'expInfo'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[1;32mIn[7], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;66;03m# vrExperiment registration and preprocessing \u001b[39;00m\n\u001b[0;32m 2\u001b[0m vrReg \u001b[38;5;241m=\u001b[39m vre\u001b[38;5;241m.\u001b[39mvrExperimentRegistration(mouseName, dateString, session, oasis\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, imaging\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[1;32m----> 3\u001b[0m \u001b[43mvrReg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdoPreprocessing\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 4\u001b[0m vrReg\u001b[38;5;241m.\u001b[39msaveParams()\n\u001b[0;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(vrReg\u001b[38;5;241m.\u001b[39msessionPath())\n",
"File \u001b[1;32m~\\Documents\\GitHub\\vrAnalysis\\vrExperiment.py:271\u001b[0m, in \u001b[0;36mvrExperimentRegistration.doPreprocessing\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 269\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdoPreprocessing\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m 270\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprocessTimeline()\n\u001b[1;32m--> 271\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mprocessBehavior\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 272\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprocessImaging()\n\u001b[0;32m 273\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprocessFacecam()\n",
"File \u001b[1;32m~\\Documents\\GitHub\\vrAnalysis\\vrExperiment.py:348\u001b[0m, in \u001b[0;36mvrExperimentRegistration.processBehavior\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 345\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mprocessBehavior\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m 346\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mopts[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvrBehaviorVersion\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m1\u001b[39m: \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHave not coded alternative vrBehavior outputs... \u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m--> 348\u001b[0m expInfo \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvrFile\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mexpInfo\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[0;32m 349\u001b[0m trialInfo \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvrFile[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtrialInfo\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m 350\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mregisterValue(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnumTrials\u001b[39m\u001b[38;5;124m'\u001b[39m,np\u001b[38;5;241m.\u001b[39msum(trialInfo\u001b[38;5;241m.\u001b[39mtrialIdx\u001b[38;5;241m>\u001b[39m\u001b[38;5;241m0\u001b[39m))\n",
"\u001b[1;31mKeyError\u001b[0m: 'expInfo'"
]
}
],
"source": [
"# vrExperiment registration and preprocessing \n",
"mouseName = 'ATL020'\n",
"dateString = '2023-05-04'\n",
"session = '702'\n",
"vrReg = vre.vrExperimentRegistration(mouseName, dateString, session, oasis=False, imaging=True)\n",
"vrReg.doPreprocessing()\n",
"vrReg.saveParams()\n",
Expand All @@ -93,9 +162,7 @@
},
"outputs": [],
"source": [
"mouseName = 'ATL020'\n",
"dateString = '2023-05-04'\n",
"session = '702'\n",
"# Load registered vrExperiment\n",
"vrexp = vre.vrExperiment(mouseName, dateString, session)"
]
},
Expand Down

0 comments on commit 70b7004

Please sign in to comment.