{"action":"created","comment":{"url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/comments/29156747","id":29156747,"diff_hunk":"@@ -0,0 +1,331 @@\n+'''\n+ExpSettingsVal - \n+Validates Experimental Settings against a set of rules known to cause \n+the Compiler (Compiler.py) to fail if they are not followed\n+\n+Created on April 17, 2015\n+\n+Original Author: Brian Donovan\n+\n+Copyright 2015 Raytheon BBN Technologies\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+   http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+'''\n+\n+import h5py\n+import Libraries\n+import QGL.Channels\n+\n+from QGL.mm import multimethod\n+from instruments.AWGs import APS, APS2, Tek5014\n+\n+from atom.api import Str\n+\n+channels = Libraries.channelLib.channelDict\n+instruments = Libraries.instrumentLib.instrDict\n+measurements = Libraries.measLib.filterDict\n+sweeps = Libraries.sweepLib.sweepDict\n+\n+# The following naming conventions are currently enforced\n+# See: https://github.com/BBN-Q/PyQLab/wiki\n+#\n+# Two LogicalMarkerChannels are required:\n+#   1 digitizerTrig\n+#   2 slaveTrig\n+#\n+# Logical Channels: \n+#   1 PhysicalChannel but be in library\n+#\t2 LogicalMarkerChannel must map to PhysicalMarkerChannel\n+#\n+# Physical Channels:\n+#   1 PhysicalChannel must have an AWG assigned\n+# \t2 The assigned AWG must exist in the library\n+#\t3 The name of the PhysicalChannel channel must be of the form AWGName-AWGChannel\n+#   4 Device specific naming conventions\n+#     APS: 12, 34, 1m1, 2m1, 3m1, 4m1\n+#     APS2: 12, 12m1, 12m2, 12m3, 12m4\n+#     Tek5014: 12, 34, 1m1, 1m2, 2m1, 2m2, 3m1, 3m2, 4m1, 4m2\n+\n+# Conventions to be added\n+# \n+#\n+\n+#####################################################################################\n+## Helper functions for list comprehension \n+\n+def is_logicalmarker_channel(name):\n+\treturn is_channel_type(name, QGL.Channels.LogicalMarkerChannel)\t\n+\n+def is_physicalmarker_channel(name):\n+\treturn is_channel_type(name, QGL.Channels.PhysicalMarkerChannel)\t\n+\n+def is_physicalIQ_channel(name):\n+\treturn is_channel_type(name, QGL.Channels.PhysicalQuadratureChannel)\t\n+\n+def is_qubit_channel(name):\n+\treturn is_channel_type(name, QGL.Channels.Qubit)\t\n+\n+def is_measurement_channel(name):\n+\treturn is_channel_type(name, QGL.Channels.Measurement)\t\n+\n+def requires_physical_channel(name):\n+\treturn (is_channel_type(name, QGL.Channels.Qubit) or\n+\t        is_channel_type(name, QGL.Channels.LogicalMarkerChannel) or\n+\t        is_channel_type(name, QGL.Channels.Measurement))\n+\n+def is_channel_type(name, channelType):\n+\tchannels = Libraries.channelLib.channelDict\n+\treturn isinstance(channels[name], channelType)\t\n+\n+#####################################################################################\n+### Apply global rules\n+\n+def test_require_physical():\n+\t\"\"\"Enforces rule requiring physical channels for certain logical channels\n+\n+\t   See requires_physical_channel() for list of Channel types requiring a\n+\t   Physical channel.\n+\t\"\"\"\n+\terrors = []\n+\tchannels = Libraries.channelLib.channelDict\n+\ttestChannels = [channelName for channelName in channels.keys() if requires_physical_channel(channelName)]\n+\n+\tfor channel in testChannels:\n+\t\tphysicalChannel = channels[channel].physChan\n+\n+\t\tif physicalChannel is None:\n+\t\t\tprint '\"{0}\" channel \"{1}\" Physical Channel is not defined'.format(channels[channel].__class__.__name__, channel)\n+\t\t\terrors.append(channel)\n+\n+\treturn errors\n+\n+## Apply invidual test based on channel type\n+def test_logical_channels():\n+\t\"\"\"\n+\t\tEnforces rules applied against logical channels\n+\n+\t\tThese are rules in addition to those applied at the global level.\n+\n+\t\tRules:\n+\t\tPhysicalChannel but be in library\n+\t\tLogicalMarkerChannel must map to PhysicalMarkerChannel\n+\t\"\"\"","path":"ExpSettingsVal.py","position":126,"original_position":122,"commit_id":"b1bbac2468f0ca0e4f1fff96f1e7de50d824bdcd","original_commit_id":"0505a9e5e700b7d76875696d02a757b8d43a6ab2","user":{"login":"bcdonovan","id":1385694,"avatar_url":"https://avatars.githubusercontent.com/u/1385694?v=3","gravatar_id":"","url":"https://api.github.com/users/bcdonovan","html_url":"https://github.com/bcdonovan","followers_url":"https://api.github.com/users/bcdonovan/followers","following_url":"https://api.github.com/users/bcdonovan/following{/other_user}","gists_url":"https://api.github.com/users/bcdonovan/gists{/gist_id}","starred_url":"https://api.github.com/users/bcdonovan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcdonovan/subscriptions","organizations_url":"https://api.github.com/users/bcdonovan/orgs","repos_url":"https://api.github.com/users/bcdonovan/repos","events_url":"https://api.github.com/users/bcdonovan/events{/privacy}","received_events_url":"https://api.github.com/users/bcdonovan/received_events","type":"User","site_admin":false},"body":"Implemented","created_at":"2015-04-27T15:26:38Z","updated_at":"2015-04-27T15:26:38Z","html_url":"https://github.com/BBN-Q/PyQLab/pull/29#discussion_r29156747","pull_request_url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/comments/29156747"},"html":{"href":"https://github.com/BBN-Q/PyQLab/pull/29#discussion_r29156747"},"pull_request":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29","id":34106869,"html_url":"https://github.com/BBN-Q/PyQLab/pull/29","diff_url":"https://github.com/BBN-Q/PyQLab/pull/29.diff","patch_url":"https://github.com/BBN-Q/PyQLab/pull/29.patch","issue_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues/29","number":29,"state":"open","locked":false,"title":"Feature/explinter","user":{"login":"bcdonovan","id":1385694,"avatar_url":"https://avatars.githubusercontent.com/u/1385694?v=3","gravatar_id":"","url":"https://api.github.com/users/bcdonovan","html_url":"https://github.com/bcdonovan","followers_url":"https://api.github.com/users/bcdonovan/followers","following_url":"https://api.github.com/users/bcdonovan/following{/other_user}","gists_url":"https://api.github.com/users/bcdonovan/gists{/gist_id}","starred_url":"https://api.github.com/users/bcdonovan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcdonovan/subscriptions","organizations_url":"https://api.github.com/users/bcdonovan/orgs","repos_url":"https://api.github.com/users/bcdonovan/repos","events_url":"https://api.github.com/users/bcdonovan/events{/privacy}","received_events_url":"https://api.github.com/users/bcdonovan/received_events","type":"User","site_admin":false},"body":"Validation for ExpSettings JSON files.","created_at":"2015-04-25T14:12:00Z","updated_at":"2015-04-27T15:26:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41c92b051019cb8707f63091a016cbc27ae7860c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29/commits","review_comments_url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29/comments","review_comment_url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues/29/comments","statuses_url":"https://api.github.com/repos/BBN-Q/PyQLab/statuses/b1bbac2468f0ca0e4f1fff96f1e7de50d824bdcd","head":{"label":"BBN-Q:feature/explinter","ref":"feature/explinter","sha":"b1bbac2468f0ca0e4f1fff96f1e7de50d824bdcd","user":{"login":"BBN-Q","id":1385056,"avatar_url":"https://avatars.githubusercontent.com/u/1385056?v=3","gravatar_id":"","url":"https://api.github.com/users/BBN-Q","html_url":"https://github.com/BBN-Q","followers_url":"https://api.github.com/users/BBN-Q/followers","following_url":"https://api.github.com/users/BBN-Q/following{/other_user}","gists_url":"https://api.github.com/users/BBN-Q/gists{/gist_id}","starred_url":"https://api.github.com/users/BBN-Q/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BBN-Q/subscriptions","organizations_url":"https://api.github.com/users/BBN-Q/orgs","repos_url":"https://api.github.com/users/BBN-Q/repos","events_url":"https://api.github.com/users/BBN-Q/events{/privacy}","received_events_url":"https://api.github.com/users/BBN-Q/received_events","type":"Organization","site_admin":false},"repo":{"id":3932434,"name":"PyQLab","full_name":"BBN-Q/PyQLab","owner":{"login":"BBN-Q","id":1385056,"avatar_url":"https://avatars.githubusercontent.com/u/1385056?v=3","gravatar_id":"","url":"https://api.github.com/users/BBN-Q","html_url":"https://github.com/BBN-Q","followers_url":"https://api.github.com/users/BBN-Q/followers","following_url":"https://api.github.com/users/BBN-Q/following{/other_user}","gists_url":"https://api.github.com/users/BBN-Q/gists{/gist_id}","starred_url":"https://api.github.com/users/BBN-Q/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BBN-Q/subscriptions","organizations_url":"https://api.github.com/users/BBN-Q/orgs","repos_url":"https://api.github.com/users/BBN-Q/repos","events_url":"https://api.github.com/users/BBN-Q/events{/privacy}","received_events_url":"https://api.github.com/users/BBN-Q/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BBN-Q/PyQLab","description":"A python library for instrument control and superconducting QIP experiments. ","fork":false,"url":"https://api.github.com/repos/BBN-Q/PyQLab","forks_url":"https://api.github.com/repos/BBN-Q/PyQLab/forks","keys_url":"https://api.github.com/repos/BBN-Q/PyQLab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BBN-Q/PyQLab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BBN-Q/PyQLab/teams","hooks_url":"https://api.github.com/repos/BBN-Q/PyQLab/hooks","issue_events_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues/events{/number}","events_url":"https://api.github.com/repos/BBN-Q/PyQLab/events","assignees_url":"https://api.github.com/repos/BBN-Q/PyQLab/assignees{/user}","branches_url":"https://api.github.com/repos/BBN-Q/PyQLab/branches{/branch}","tags_url":"https://api.github.com/repos/BBN-Q/PyQLab/tags","blobs_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/refs{/sha}","trees_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BBN-Q/PyQLab/statuses/{sha}","languages_url":"https://api.github.com/repos/BBN-Q/PyQLab/languages","stargazers_url":"https://api.github.com/repos/BBN-Q/PyQLab/stargazers","contributors_url":"https://api.github.com/repos/BBN-Q/PyQLab/contributors","subscribers_url":"https://api.github.com/repos/BBN-Q/PyQLab/subscribers","subscription_url":"https://api.github.com/repos/BBN-Q/PyQLab/subscription","commits_url":"https://api.github.com/repos/BBN-Q/PyQLab/commits{/sha}","git_commits_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/commits{/sha}","comments_url":"https://api.github.com/repos/BBN-Q/PyQLab/comments{/number}","issue_comment_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues/comments{/number}","contents_url":"https://api.github.com/repos/BBN-Q/PyQLab/contents/{+path}","compare_url":"https://api.github.com/repos/BBN-Q/PyQLab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BBN-Q/PyQLab/merges","archive_url":"https://api.github.com/repos/BBN-Q/PyQLab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BBN-Q/PyQLab/downloads","issues_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues{/number}","pulls_url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls{/number}","milestones_url":"https://api.github.com/repos/BBN-Q/PyQLab/milestones{/number}","notifications_url":"https://api.github.com/repos/BBN-Q/PyQLab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BBN-Q/PyQLab/labels{/name}","releases_url":"https://api.github.com/repos/BBN-Q/PyQLab/releases{/id}","created_at":"2012-04-04T19:36:43Z","updated_at":"2015-04-24T21:35:27Z","pushed_at":"2015-04-27T15:23:13Z","git_url":"git://github.com/BBN-Q/PyQLab.git","ssh_url":"git@github.com:BBN-Q/PyQLab.git","clone_url":"https://github.com/BBN-Q/PyQLab.git","svn_url":"https://github.com/BBN-Q/PyQLab","homepage":"","size":3192,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":4,"default_branch":"develop"}},"base":{"label":"BBN-Q:develop","ref":"develop","sha":"055850f7e3b5b48b78c8a15903ed89682218bc65","user":{"login":"BBN-Q","id":1385056,"avatar_url":"https://avatars.githubusercontent.com/u/1385056?v=3","gravatar_id":"","url":"https://api.github.com/users/BBN-Q","html_url":"https://github.com/BBN-Q","followers_url":"https://api.github.com/users/BBN-Q/followers","following_url":"https://api.github.com/users/BBN-Q/following{/other_user}","gists_url":"https://api.github.com/users/BBN-Q/gists{/gist_id}","starred_url":"https://api.github.com/users/BBN-Q/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BBN-Q/subscriptions","organizations_url":"https://api.github.com/users/BBN-Q/orgs","repos_url":"https://api.github.com/users/BBN-Q/repos","events_url":"https://api.github.com/users/BBN-Q/events{/privacy}","received_events_url":"https://api.github.com/users/BBN-Q/received_events","type":"Organization","site_admin":false},"repo":{"id":3932434,"name":"PyQLab","full_name":"BBN-Q/PyQLab","owner":{"login":"BBN-Q","id":1385056,"avatar_url":"https://avatars.githubusercontent.com/u/1385056?v=3","gravatar_id":"","url":"https://api.github.com/users/BBN-Q","html_url":"https://github.com/BBN-Q","followers_url":"https://api.github.com/users/BBN-Q/followers","following_url":"https://api.github.com/users/BBN-Q/following{/other_user}","gists_url":"https://api.github.com/users/BBN-Q/gists{/gist_id}","starred_url":"https://api.github.com/users/BBN-Q/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BBN-Q/subscriptions","organizations_url":"https://api.github.com/users/BBN-Q/orgs","repos_url":"https://api.github.com/users/BBN-Q/repos","events_url":"https://api.github.com/users/BBN-Q/events{/privacy}","received_events_url":"https://api.github.com/users/BBN-Q/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/BBN-Q/PyQLab","description":"A python library for instrument control and superconducting QIP experiments. ","fork":false,"url":"https://api.github.com/repos/BBN-Q/PyQLab","forks_url":"https://api.github.com/repos/BBN-Q/PyQLab/forks","keys_url":"https://api.github.com/repos/BBN-Q/PyQLab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BBN-Q/PyQLab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BBN-Q/PyQLab/teams","hooks_url":"https://api.github.com/repos/BBN-Q/PyQLab/hooks","issue_events_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues/events{/number}","events_url":"https://api.github.com/repos/BBN-Q/PyQLab/events","assignees_url":"https://api.github.com/repos/BBN-Q/PyQLab/assignees{/user}","branches_url":"https://api.github.com/repos/BBN-Q/PyQLab/branches{/branch}","tags_url":"https://api.github.com/repos/BBN-Q/PyQLab/tags","blobs_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/refs{/sha}","trees_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BBN-Q/PyQLab/statuses/{sha}","languages_url":"https://api.github.com/repos/BBN-Q/PyQLab/languages","stargazers_url":"https://api.github.com/repos/BBN-Q/PyQLab/stargazers","contributors_url":"https://api.github.com/repos/BBN-Q/PyQLab/contributors","subscribers_url":"https://api.github.com/repos/BBN-Q/PyQLab/subscribers","subscription_url":"https://api.github.com/repos/BBN-Q/PyQLab/subscription","commits_url":"https://api.github.com/repos/BBN-Q/PyQLab/commits{/sha}","git_commits_url":"https://api.github.com/repos/BBN-Q/PyQLab/git/commits{/sha}","comments_url":"https://api.github.com/repos/BBN-Q/PyQLab/comments{/number}","issue_comment_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues/comments{/number}","contents_url":"https://api.github.com/repos/BBN-Q/PyQLab/contents/{+path}","compare_url":"https://api.github.com/repos/BBN-Q/PyQLab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BBN-Q/PyQLab/merges","archive_url":"https://api.github.com/repos/BBN-Q/PyQLab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BBN-Q/PyQLab/downloads","issues_url":"https://api.github.com/repos/BBN-Q/PyQLab/issues{/number}","pulls_url":"https://api.github.com/repos/BBN-Q/PyQLab/pulls{/number}","milestones_url":"https://api.github.com/repos/BBN-Q/PyQLab/milestones{/number}","notifications_url":"https://api.github.com/repos/BBN-Q/PyQLab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BBN-Q/PyQLab/labels{/name}","releases_url":"https://api.github.com/repos/BBN-Q/PyQLab/releases{/id}","created_at":"2012-04-04T19:36:43Z","updated_at":"2015-04-24T21:35:27Z","pushed_at":"2015-04-27T15:23:13Z","git_url":"git://github.com/BBN-Q/PyQLab.git","ssh_url":"git@github.com:BBN-Q/PyQLab.git","clone_url":"https://github.com/BBN-Q/PyQLab.git","svn_url":"https://github.com/BBN-Q/PyQLab","homepage":"","size":3192,"stargazers_count":4,"watchers_count":4,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":9,"forks":2,"open_issues":9,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29"},"html":{"href":"https://github.com/BBN-Q/PyQLab/pull/29"},"issue":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/issues/29"},"comments":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/BBN-Q/PyQLab/statuses/b1bbac2468f0ca0e4f1fff96f1e7de50d824bdcd"}}}}