Difference between revisions of "Programming"
Line 4: | Line 4: | ||
==Best practices== | ==Best practices== | ||
+ | |||
+ | One of the first things you have to consider when programming is how your program will be used. | ||
+ | |||
+ | *Will other people use the program? | ||
+ | *Will it be used for a long time? | ||
+ | *Will the results be used in a paper? | ||
+ | *Do other people need to understand or be able to edit your code? | ||
+ | *Do you anticipate changes in the future? | ||
+ | *Will it be published in Gitlab? | ||
+ | |||
+ | If you can answer '''one''' of these questions with yes you should use '''best programming practices''' | ||
+ | |||
+ | |||
+ | |||
+ | *Use proper code indentation | ||
+ | *Use meaningful names | ||
+ | *Use comments that add context | ||
+ | *Don’t repeat yourself | ||
+ | *Be sparse with nesting | ||
==Matlab== | ==Matlab== |
Revision as of 13:15, 19 June 2023
Introduction
Most work in the Biophysics group is done with help of Matlab (Experiments, data manipulation, graphics). Embedded systems are mostly written in C++. Tucker Davis equipment have their own graphical programming system.
Best practices
One of the first things you have to consider when programming is how your program will be used.
- Will other people use the program?
- Will it be used for a long time?
- Will the results be used in a paper?
- Do other people need to understand or be able to edit your code?
- Do you anticipate changes in the future?
- Will it be published in Gitlab?
If you can answer one of these questions with yes you should use best programming practices
- Use proper code indentation
- Use meaningful names
- Use comments that add context
- Don’t repeat yourself
- Be sparse with nesting
Matlab
The Matlab IDE gets updated almost every year. Different experimental computers and your own computer will probably run different version of Matlab. Most of the programs will be compatible, but user interfaces often not. On Gitlab we have several libraries for experiments and data manipulation.
Installation
License
Systems
Experiment computers
Most of the programs running on the experiment computers are written in Matlab.
Digital sound processor (DSP)
The most used DSP is the RZ6 of Tucker Davis. Also the older RP2.1 and the Medusa RA16 base station are still in use. These are programmed in the RPvdsEx IDE. For the RZ6 we have BIOX, which is a RPvdsEx file with an Matlab toolbox.
Sometimes MOTU DSP's are used.
BIOX
Embedded systems
Some embedded systems like arduino, and raspberry Pi's are programmed in C++.