-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrument/spectro270 m #1103
base: master
Are you sure you want to change the base?
Instrument/spectro270 m #1103
Conversation
This reverts commit 3698e6b.
initial commit
Creation of the auto_baud function for initialising the 270M and the motor function.
We have added some functions for basic control of the spectrometer control.
We have added the function for controlling the motor depending on the wavelength, and controlling that the motor is not busy.
Adaptation to work in pyvisa instead of serial, and creation of the grating motor property and grating motor setter, as well as grating wavelength property and setter, to control respectively the absolute position of the grating motor and the wavelength.
Update in the authors file
…nd the start of the test file
writing properties of the grating and slits motors, writing methods
writing tests for the spectrometer
Updating the read and write functions, and the timeouts.
Deleting unnecessary file
Updating the test file without the device.
Modification to the test file
…/pymeasure into pymeasure_properties
adding test for get_entry_slit_microns
Updating the test files
…/pymeasure into pymeasure_properties
Updating the test functions for the entry and exit slits
Update to the tests
Mistake
Added the test files for the entry slit microns functions and for the motor stop and motor busy check
Finishing the test file without device for the Jobin Yvon 270M Spectrometer.
Further commenting the code of the driver for the Jobin Yvon 270M spectrometer.
Updating the test file without device for the spectrometer JY270m.
Correcting some problems of the JY270m's test with device.
Slight modification of the test file for the JY270m spectrometer.
Defining two extra properties that will be used in the test file for the JY270m instrument.
Further commenting the test file with device for the JY270M.
Welcome you two @Daniel-Mael. Thanks for contributing. As a start, please merge the current master branch into your branch in order to have an up to date code base. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
Here is a first round of comments. Don't be discouraged by them.
###### | ||
JobinYvon | ||
###### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add spaces in the title as it is meant for humans. Also, the hashes should be as long as the text, for example:
###### | |
JobinYvon | |
###### | |
########## | |
Jobin Yvon | |
########## |
###################### | ||
Jobin Yvon Instruments | ||
###################### | ||
|
||
|
||
Spectro270M Spectrometer | ||
======================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is only for the Spectro 270M spectrometer, therefore you do not need to repeat the manufacturer name. The manufacturer name from jobinyvon/index.rst
will be the header!
###################### | |
Jobin Yvon Instruments | |
###################### | |
Spectro270M Spectrometer | |
======================== | |
######################## | |
Spectro270M Spectrometer | |
######################## |
@property | ||
def lambda_0(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you use properties instead of just setting lambda_0 = 1171.68
?
kwargs.update(dict(baud_rate=9600, | ||
timeout=self.default_timeout, | ||
parity=Parity.none, | ||
data_bits=8, | ||
stop_bits=StopBits.one, | ||
flow_control=ControlFlow.dtr_dsr, | ||
write_termination='', | ||
read_termination='', | ||
includeSCPI=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which of these things is hard coded and cannot be changed?
These unchangable parameters (for example includeSCPI) can enter directly the super().__init__()
call.
name, | ||
**kwargs) | ||
|
||
gsteps = Instrument.control( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grating_steps
would be more descriptive, wouldn't it?
def check_get_errors(self, error): | ||
print(error) | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are you doing here?
Residual of testing?
def motor_busy_check(self): | ||
""" | ||
This function checks if at least one of the motors is busy. | ||
""" | ||
ans = self.write_read(b'E\r').decode() | ||
if ans == "oz": | ||
"We return False if the motor is not busy." | ||
return False | ||
if ans == "oq": | ||
"We return True if the motor is busy." | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a property: motor_busy
, which will return True or False?
def motor_busy_check(self): | |
""" | |
This function checks if at least one of the motors is busy. | |
""" | |
ans = self.write_read(b'E\r').decode() | |
if ans == "oz": | |
"We return False if the motor is not busy." | |
return False | |
if ans == "oq": | |
"We return True if the motor is busy." | |
return True | |
motor_busy = Instrument.measurement("E\r", values={True: "oq", False: "oz"}, map_values=True) |
if __name__ == '__main__': | ||
spectro = JY270M('COM1', | ||
baud_rate=9600, | ||
timeout=300, | ||
parity=Parity.none, | ||
data_bits=8, | ||
stop_bits=StopBits.one, | ||
flow_control=ControlFlow.dtr_dsr, | ||
write_termination='', | ||
read_termination='', | ||
includeSCPI=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove these lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding tests!
@pytest.fixture(scope="module") | ||
def init_communication(): | ||
instr = JY270M('COM1', | ||
baud_rate=9600, | ||
timeout=300, | ||
parity=Parity.none, | ||
data_bits=8, | ||
stop_bits=StopBits.one, | ||
flow_control=ControlFlow.dtr_dsr, | ||
write_termination='', | ||
read_termination='', | ||
includeSCPI=False) | ||
return instr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See our documentation on how to write device tests.
For we have a fixture, which allows to give the resource name via command line parameter as not everyone has their instrument at COM1.
Hi,
We are two students at the National Institute of Applied Sciences (INSA) in Toulouse, France, working on a project with Mr. Sébastien Weber.
The project aims at instrumenting an optical spectrometer type Jobin Yvon 270M using Python. After creating a Python driver for this instrument, we want to use it with PyMoDAQ.
Yours sincerely,
Maël Le Blanc and Daniel Perales Rios
4th year Engineering Physics students at INSA Toulouse