Repository navigation
New AMI430 driver - #700
New AMI430 driver #700
Conversation
2) added a mock IP module to mock IP instruments 3) added a debug module to debug the AMI430 instrument
…rdinates. Work in progress
…cylindrical coodinates. By keeping a prepresnetation of the vector in all three systems, there is less risk of loss of information so that e.g. the field strength can be ramped up given previous supplied phi and theta. The spherical and cylindrical tests seem to work.
2) Made proper tests
2) Made proper tests
…uments 2) Made test to verify that the correct error is raised if we intentionally exceed the field limits
… Tests to verify this are also included.
…e mocking mechanism
…e mocking mechanism
…rdinates. Added tests to verify if we can get spherical coordinates. Also, when getting single field values, return a single float instead of an array of length one
2) Added test to verify that the correct warnings are raised if we change the default maximum ramp rate 3) Added test to verify that an error is raised if the ramp rate larger then the maximum
| <component name="VcsDirectoryMappings"> | ||
| <mapping directory="$PROJECT_DIR$" vcs="Git" /> | ||
| </component> | ||
| </project> No newline at end of file |
There was a problem hiding this comment.
I don't think this should go into version control?
There was a problem hiding this comment.
probably add it to .gitignore
There was a problem hiding this comment.
For some reason, I cannot remove this file from the PR. Any idea's?
There was a problem hiding this comment.
Ok Lets leave it for now, If it contains local specific information we can remove it later
| channels: | ||
| - anaconda | ||
| - conda-forge | ||
| - dsdale24 |
There was a problem hiding this comment.
I think the channels should just be:
- defaults
- conda-forge
There was a problem hiding this comment.
The dsdate24 is not used and the preferred name for the default is default. With the setup above I ended up with all packages looking like they are outdated because default has higher priority than anaconda
There was a problem hiding this comment.
I will make the changes as you suggest and see if I can create a working environment.
|
|
||
| def __init__(self, name, testing=False, **kwargs): | ||
| self.name = str(name) | ||
| self.testing = testing |
There was a problem hiding this comment.
This should probably be a private attribute _testing
There was a problem hiding this comment.
yeah good point
There was a problem hiding this comment.
We could also make it a property that cannot be set and get rid of the is_testing method below. Whichever way you prefer but there should only be one public attribute/method
Jens Hedegaard Nielsen (jenshnielsen)
left a comment
There was a problem hiding this comment.
Looks good to me. Left some more inline comments
| def get_mock_messages(self): | ||
| """ | ||
| For testing purposes we might want to get log messages from the mocker. | ||
| :return: mocker_messages: list, str |
There was a problem hiding this comment.
We are generally using google style with sphinx napoleon http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html rather than native formatting of doc strings
There was a problem hiding this comment.
I will adjust the doc strings
| "functions": {name: func.snapshot(update=update) for name, func in self.functions.items()}, | ||
| "submodules": {name: subm.snapshot(update=update) for name, subm in self.submodules.items()}, | ||
| "__class__": full_class(self) | ||
| } |
There was a problem hiding this comment.
We have not been enforcing it but we have been trying to move towards pep8 and <79 char per line
There was a problem hiding this comment.
I do not exactly understand why this is giving me pep8 issues. My pycharm editor also complains about this line, but I do not understand why.
There was a problem hiding this comment.
The line is longer than 79 characters now? no. The wrapping was to make it shorter
There was a problem hiding this comment.
It is complaining that the dictionary can be re-written as a dict literal. So literal:
some_dict = {"A": 1, "B": 2}
vs.
dict(A=1, B=1).
But as far as I can see the dictionary is literal, so I do not understand the complaint.
There was a problem hiding this comment.
This link has some explaination: link, but I do not understand how this applies here. Anyway, I do not think this issue is very important and I propose to ignore it.
There was a problem hiding this comment.
Agreed that seems wrong to me. I think its safe to ignore that
| from datetime import datetime | ||
|
|
||
|
|
||
| class MockAMI430(object): |
There was a problem hiding this comment.
No need to inherit from object. We only support python3
| :param msg_str: string, the message string the mock instrument gets through the network socket. | ||
| :param key: string, one of the keys in self.handlers | ||
| :return: (match, args), (bool, string), if the key and the msg_str match, then match = True. If any arguments | ||
| are present in the message string these will be passed along. |
There was a problem hiding this comment.
Google style
| @@ -0,0 +1,463 @@ | |||
| { | |||
There was a problem hiding this comment.
This file should go in the drivers example folder (1 below this one)
| "outputs": [], | ||
| "source": [ | ||
| "import sys \n", | ||
| "sys.path.append(r\"C:\\Users\\a-sochat\\development\\Qcodes_QUTech\")\n", |
There was a problem hiding this comment.
Why is this needed. We should aim at having all notebooks something that users can run if they have the right hardware
There was a problem hiding this comment.
This is needed because the notebook is not in the root folder of the qcodes module. If the qcodes module is not in a location where python can find it, we need to specifically add the module path to the system path. If the user running this notebook has qcodes installed in a standard location then this is not necessary. I will remove the line from the notebook
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "\n", |
There was a problem hiding this comment.
Is this image added to the repository
There was a problem hiding this comment.
I think I should remove the picture all togehter. I don't think we should have large images in the repo. A comment that we have manually checked that the instrument displays show that the correct currents are reached should suffice.
| "theta": np.random.uniform(0, 180), | ||
| "phi": np.random.uniform(0, 360), | ||
| "rho": np.random.uniform(0, 1) | ||
| }[coordinate_name] |
There was a problem hiding this comment.
I would use hypothesis https://hypothesis.readthedocs.io/en/latest/ in any test that relies on random data
There was a problem hiding this comment.
I do not know that module but I will familiarize myself and use it here.
There was a problem hiding this comment.
It not needed, only a suggestion because I think it's cool and we are already using it. Feel free to leave as it is
There was a problem hiding this comment.
wow thats a useful library. Good to know!
| """ | ||
| :param msg: string, a message received through the socket communication layer | ||
| :return: string or None, If the type of message requests a value (a get message) then this value is returned | ||
| by this function. A set message will return a None value. |
There was a problem hiding this comment.
google style
| 1) There are contradictory inputs (e.g. x=3, y=4, z=0 and rho=6) | ||
| """ | ||
|
|
||
| for _ in range(1): |
There was a problem hiding this comment.
Why is this for loop needed?
I would remove it and replace the breaks with return. That should be equivalent?
There was a problem hiding this comment.
I think a break statement only works in loops.Your suggestions would indeed be equivalent. Ideally we want to have a single exit point in fuctions, however my solution is not ideal either. I will replace the breaks by return.
There was a problem hiding this comment.
Btw... the situation would be a little trickier if after the loop we had other code. We could not simply return as the rest of the code would not be reachable. A better solution has been implemented in the code. See the updated PR shortly
…pep8 conventions. Will do that tomorrow
Author: sohail chatoor <schatoor@gmail.com>
New AMI430 driver (#700)
Author: sohail chatoor <schatoor@gmail.com>
New AMI430 driver (#700)
This should fix issue 648.
#648
I have added some tests to see if this is the case.
I have also added an environment.yml file so that to install the enviromnent to develop and run qcodes, we can just do (from the command line):
git clone
cd qcodes
conda env create