python : shift values along a curve - python

I am trying to figure out a way to do this sort of thing.
I would be happy to hear any suggestions on this type of interpolation.
I have 2 fixed values A and H, and n extra random values in between.
In my example they are on a path, although I would be happy also if I could figure out how to solve it for a straight line.
Passing a global variable to my script I would like to displace these in between points in such a way that they are changed to gradually increasing/decreasing their distance between themselves and the two extremes accordingly (incrementally as shown on the image).

Related

Is there a technique to find the boundaries of two 'splashes' on the graph?

Ok, so I am looking for an algorithm that can calculate the boundaries of two 'splashes' that are depicte on the following graph. This is the graph. We can observe here two 'splashes' in the middle
So I was trying to solve this with the derivative but it only worked when there is one splash, not two or more. If you worked with time-series or just know how to find the asnwer, please, feel free to write below. Thank you in advance!
One approach would be to move two points along a line with a small horizontal offset between them. You can use these points to calculate local slope, and when the slope exceeds a threshold, mark the location between the points as a "boundary" by adding it to a boundary list.

Splitting a graph

I have an array of 575 points.
When I represent it on graph, I get following curve shown in the attached image.
I want to split it in sub graphs when slope becomes 0 or you can say when the graph becomes parallel to x-axis.
Thanks in advance.
I understand you want to have some degree of smoothness, otherwise you will have as a result many small separated regions of the graph.
You also may need to specifically define what you want to consider as parallel to the x-axis.
I suggest to start by moving a running window of certain length that categorizes each range being studied as horizontal given certain condition.
This condition can be something like "all values are inside certain range". This condition may take into account characteristics like the variance and the mean of the points inside the window. For example, "all values are between 101% and 99% of the mean."

Move ax.text a bit away from data point

I am trying to create a type of map that plots a route between points.
As such I have something that looks like the image below:
And as you can see, the bll label is very close to the data point. I would like it to be a bit further away, so you can actually see the dot.
Also, the text is just a regular ax.text plot with x and y values.
My problem is, that yes, I could just add some kind of percentage value or something. However, depending on the coordinate and x-value, this will not be the same depending on you being very far left, where x => 0, or far right where x => max value of the plot. Then you could argue I could just add 10 or 20 units, but in my case I produce different maps depending on different routes. So this means that the x-axis values are not the same. Sometimes the map is big, and sometimes it's small. So using the same value in all maps will make bll text move either very much or very little depending on size.
Also, if I am ever to zoom on the map, this would adjust the text as well if I were to use some kind of value extension, since the distance between the data point AND the text will also increase relative to the size of the zoom, like this figure:
Can this be solved in a somewhat simple manner ?
Best regards

How to efficiently store, check for inclusion and retrieve large amounts of float numbers in python?

let me describe my problem, so I am creating a simple graphing calculator, the way I did it was that every y coordinate is calculated by putting it into a function f(x) then graphing the point (x, f(x)).
To make things simple for myself, whenever I wanted to shift the graph or zoom in I just adjust the dimensions of the current view and then recalculate all the new points on the screen. For example going from This to this by zooming in and shifting the screen would mean that every single point has been recalculated, for me to get the graph to look like it is formed by actual lines instead of just points I divide the width of the screen into about 1000 ~ 10000 points and plot it and if there are enough points it just looks like lines. These points are made by tuple pairs of floats.
As you could imagine there is a lot of overlap and recalculations that may be slowing down the program and so I am wondering what the best way to calculate a (x, f(x)) point, store it and anytime I change the view of the graph, if that x happens to be in view, be able to retrieve the f(x) and skip the calculation. The thing is there is going to be like thousands and thousands of these points and so I figured using list operations like "i in lst" is not efficient enough.
I am trying to make my graph as fast as possible so any suggestions would be helpful! Thanks.

Comparing fluorescence intensity of finger print residue after 5 contacts

I have an image as follows that shows the residue of fluorescent powder left on a surface after 5 sequential contacts. Is it possible to quantify the a difference in the amount of residue between contacts?
I have looked at Fiji/ImageJ and selected each finger print at a time to get the mean grey value but I don't see much difference to be honest. Any help or thoughts would be very much appreciated. Happy to think about python or matlab.
In order for the quantification of the intensities to be useful, I would imagine you would need to assume your image was evenly lit and that any fluorescence you see isn't a result of oversaturation. That being said, in principle, you could contour the given fingerprint, duplicate it to a new image, and then measure the stack histogram after adjusting the threshold such that regions darker than your fingerprint powder are set to black. Perhaps the change in distribution will illustrate the change that occurs, if any.
Edit:
First: merge the RGB channels by adding them to one another using the channel calculator function. Your signal is the result of multiple colors, so splitting it does not make sense to me here.
The steps would then be:
Duplicate your given print to a new window.
Use "Adjust Threshold" to set a threshold of 0-n, where n is the highest intensity that doesn't include your fingerprint.
Run the command "Edit/Selection/Create Selection."
Run the command "Edit/Clear."
Press "ctrl+H" to measure the histogram of the pixels, and then "List" to get the actual values.
Repeat for each print and plot on the same chart.
When you are already obtaining the actual histogram values, and not just the range from the particle analyzer, then I'm not sure there's much else that I can personally suggest.

Categories

Resources