Python Forum
Finding values to draw a line on a curve
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding values to draw a line on a curve
#1
I am newbie in Python and was attracted for a specific purpose. The project deals with Medical Physics (in cancer treatment, physics is used quite a lot) and a program called Pylinac exists for certain QA. This is what drew me to Python.

A beam profile (dose vs distance ) is obtained via a phantom. This is drawn like this:
[Image: sdfdyw.jpg]

I have to draw a line on the steep portion of the curve, on left and right. The line should be drawn on the curve such that it intersects the curve only on the steep portion and not anywhere else. I have to note the intersection of the beginning of the line and the end of the line. And midpoint of the line.

I have the values of the profile in a CSV file and can draw it. But how to draw the line based on the conditions? I have no idea. What I have done is using Excel I have subtracted the y-values from its previous rows and found something interesting. When the difference is plotted, it gives a graph like this:

[Image: v67q7t.png]

I think the gradient region of the curve is the points of the line. But how to do this in Python? and How to extract the values of the start and end point?

I have no coding experience in python and would appreciate if anybody would assist/cooperate/guide me in achieving this. This would help a lot of people in many countries.

thanks and regards
keskumar
Reply
#2
Your grid shows distance for X axis as mm from center
Do you know the vertical scale? or the x, y position of start of line and x,y position of end line.
If so, it should be a simple point to point line draw, look at how any straight line is drawn in the example

I don't know this program, but look at the code that draws any of Pa, IPl or Pb.
It should be the same code with the new coordinates.

There should also be a command to get x,y from any point somewhere within this doc: http://pylinac.readthedocs.io/en/latest/overview.html
Reply
#3
Larz60+

Thanks for the reply. To reply your question,
Y is in mm/cmm and Y is % which can go upto 100%. A line should be drawn on the left and right steep portion so as to determine what is called as a 'penumbra'. Different energies will give different penumbra result and hence a contnstant line wont work. It has to be drawn manually and note the values of X axis where thy intersect the line. That is the Pa and Pb points.

How to draw a line so that it intersects the curve, that is my question.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Learning curve astral_travel 1 219 Mar-10-2024, 08:00 AM
Last Post: snippsat
  How can I design shapes on a curve in python? mervea 2 765 Sep-14-2023, 01:04 PM
Last Post: Pedroski55
  Fitting data to a curve daaegp 1 567 Jun-30-2023, 08:06 PM
Last Post: Gribouillis
  Find factor to match test curve to golden curve SriRajesh 0 1,523 Jun-17-2021, 04:39 AM
Last Post: SriRajesh
  Fitting Gaussian curve to data file Laplace12 0 2,673 Jun-09-2021, 10:45 AM
Last Post: Laplace12
  search of a curve fitting function bluffy5 2 2,377 Dec-13-2020, 09:53 AM
Last Post: ndc85430
  how to draw vertical line on screen kalihotname 3 3,075 Aug-17-2020, 07:08 PM
Last Post: michael1789
  Add new line after finding last string in a region Nigel11 1 1,846 Aug-08-2020, 10:00 PM
Last Post: Larz60+
  Finding line numbers starting with certain string Sutsro 3 2,483 Jun-27-2020, 12:36 PM
Last Post: Yoriz
  Finding Max and Min Values Associated with Unique Identifiers in Python ubk046 1 2,012 May-08-2020, 12:04 PM
Last Post: anbu23

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020