How to get started with using Python for animal tracking? - python

I am using Python 3.X on macOS Sierra, and want to write a Python programme that should be able to: (1) load a 1 min video (format probably .avi), (2) identify white larvae (I am a biologist working on fly larvae) on a dark-ish background, (3) track the flies over the 1 min, and (4) output a .csv file with x- and y-coordinates for each larvae.
Now, what I am asking is not for anyone to write the code, I want to do that myself; rather, since I am totally new to working with videos, and only have marginal Python experience, it would help me for people to suggest a strategy I could follow to write that programme, such as specific modules that contain functions useful for this task, etc.

Related

Suggestions on Analyzing Protein Sequences Similarity

I want to write code to analyze short protein sequences and determine their similarity. I have no reference sequence but rather I want to write some sort of for loop to compare them all to each other to see how many duplicate sequences I have, as well as regions where they are similar.
I currently have all of their sequences in a csv.
I have taken a bioinformatics course and have done something similar with Illumina sequencing data but I started from an SRA table and had fasta files.
Also, I am trying to use CD hit but but I am running into problems with the makefile and the compatibility of my compiler. I installed homebrew to get around the issue but I am still running into the problem and the make CXX=g++-9 CC=gcc-9 comand won't work.
I was wondering if there was more update to the method than CD-Hit because I have noticed that no one has really used CD Hit since 2020.
Also the only coding languages I know are R and Shell but I am currently learning Python.
https://bioinfo.lifl.fr/yass/index.php
I have used it for SARS-CoV-2, found similarity to many viruses

Breaking Down 3D models up to lines and curves

I'm working on a project to breakdown 3D models but I'm quite lost. I hope you can help me.
I'm getting a 3D model from Autodesk BIM and the format could be native or generic CAD formats (.stp, .igs, .x_t, .stl). Then, I need to "measure" somehow the maximum dimensions to model a raw material body, it will always have the shape of a huge panel. Once I get both bodies, I will get the difference to extract the solids I need to analyze; and, on each of these bodies, I need to extract the faces, and then the lines or curves of each face.
This sounds something really easy to do on a CAD software, but the idea is to automate this process. I was looking into openSCAD, but seems that works only to model geometry and it doesn't handle well imported solids. I'm leaving a picture with the idea of what I need to do in the link below.
So, Any idea how can I do this? which langue and library can help in this project?
I can see this automation possible with a few in between steps:
OpenSCAD can handle differences well, so your "Extract Bodies" seems plausible
1.5 Before going further, you'll have to explain how you "filtered out" the cylinder. Will you do this manually? If you don't, you will have it considered for analysis and have a lot of faces as a result.
I don't think openSCAD provides you a vertex array. However, it can save to .STL, which is kinda easy to parse with the programming language of your choice, you'll have to study .stl file structure a bit (this sounds much more frightening than it is - if you open an stl with an editor you will probably immediately realize what's happening).
Since you've parsed the file, you can now calculate lines with high school math.
This is not an easy, GUI way to do what you ask, but if you have a few skills you'll have your automation, and depending on the amount of your projects it may be worth it.
I have been working in this project, and foundt the library "trimesh" is better to solve this concern. Give it a shot, and save some time.

Abaqus: parametric geometry/assembly in Inputfile or Python script?

i want to do something as a parametric study in Abaqus, where the parameter i am changing is a part of the assembly/geometry.
Imagine the following:
A cube is hanging on 8 ropes. Each two of the 8 ropes line up in one corner of a room. the other ends of the ropes merge with the room diagonal of the cube. It's something like a cable-driven parallel robot/rope robot.
Now, i want to calculate the forces in the ropes in different positions of the cube, while only 7 of the 8 ropes are actually used. That means i have 8 simulations for each position of my cube.
I wrote a matlab script to generate the nodes and wires of the cube in different positions and angle of rotations so i can copy them into an input file for Abaqus.
Since I'm new to Abaqus scripting etc, i wonder which is the best way to make this work.
would you guys generate 8 input files for one position of the cube and calculate
them manually or is there a way to let abaqus somehow iterate different assemblys?
I guess i should wright a python script, but i don't know how to make the ropes the parameter that is changing.
Any help is appreciated!
Thanks, Tobi
In case someon is interested, i was able to do it the following way:
I created a model in abaqus till the point, i could have started the job. Then i took the .jnl file (which is created automaticaly by abaqus) and saved it as a .py file. Then i modified this script by defining every single point as a variable and every wire for the parts as tuples, consisting out of the variables. Than i made for loops and for every 9 cases unique wire definitions, which i called during the loop. During the loop also the constraints were changed and the job were started. I also made a field output request for the endnodes of the ropes (representing motors) for there coordinates and reaction force (the same nodes are the bc pinned)
Then i saved the fieldoutput in a certain simple txt file which i was able to analyse via matlab.
Then i wrote a matlab script which created the points, attached them to the python script, copied it to a unique directory and even started the job.
This way, i was able to do geometric parametric studies in abaqus using matlab and python.
Code will be uploaded soon

Recognition and recording of digits from external window in real time using python

I want to gather numbers that are being output from a specific window in real time as data points.
I have a piece of equipment with an internal pressure level I would like to monitor. The only output that the software I'm using gives me is a single float from the last ~second in a box within the software. I've asked the manufacturers if there was any way of internal accessing this output and they basically told me there is none.
Individual measurements don't mean much to me, and I'd like to see the change in pressure across time. But watching this single value all day isn't very practical for me. So I want to make something that can read a specific line of text by recognizing the words or by giving exact coordinates on the screen (either works), say 'Output PSI: ##.###' and get the ##.### in python as a data point every time the number changes.
Are there modules that anyone has experience with that might be of use here?

Matching a Pattern in a Region in Sikuli is very slow

I am automating a computer game using Sikuli as a hobby project and to hopefully get good enough to make scripts to help me at my job. In a certain small region, (20x20 pixels) one of 15 characters will appear. Right now I have these 15 images defined as variables, and then using an if, elif loop I am doing Region.exists(). If one of my images is present in the region, I assign a variable the appropriate value.
I am doing this for two areas on the screen and then based on the combination of characters the script clicks appropriately.
The problem right now is that to run the 15 if statements is taking approximately 10 seconds. I was hoping to do this recognition in closer to 1 second.
These are just text characters but the OCR feature was not reading them reliably and I wanted close to 100% accuracy.
Is this an appropriate way to do OCR? Is there a better way you guys can recommend? I haven't done much coding in the last 3 years so I am wondering if OCR has improved and if Sikuli is still even a relevant program. Seeing as this is just a hobby project I am hoping to stick to free solutions.
Sikuli operates by scanning a Screen or a part of a screen and attempting to match a set pattern. Naturally, the smaller the pattern is, the more time it will consume to match it. There few ways to improve the detection time:
Region and Pattern manipulation (bound region size)
Functions settings (reduce minimum wait time)
Configuration (amend scan rate)
I have described the issue in some more detail here.
OCR is still quite unreliable. There are ways to improve that but if you only have a limited set of characters, I reckon you will be better off using them as patterns. It will be quicker and more reliable.
As of Sikuli itself, the tool is under active development and is still relevant if it helps you to solve your problem.

Categories

Resources