Home > database >  Need to find black point
Need to find black point

Time:05-25

I have 2D array with x and y. I need to extract black point shown on graph. Point is before sudden increase. Also I paste data for x, y.

Does anyone have any idea how to get this point?

I attached another graph (image 2), to illustrate the problem.

x = [50,30,40,40,60,70,80,90,100,110,120,130,140,160,170,180,200,210,220,240,250,270,280,300,320,340,350,370,390,410,430,450,470,490,510,530,550,570,590,610,620,650,670,690,710,730,760,780,800,820,840,860,890,910,930,950,980,1000,1020,1040,1060,1090,1110,1130,1150,1170,1200,1220,1240,1260,1280,1300,1320,1340,1360,1380,1400,1420,1440,1460,1480,1500,1510,1530,1550,1570,1590,1600,1620,1630,1650,1660,1680,1690,1710,1720,1730,1740,1760,1770,1780,1790,1800,1810,1820,1830,1830,1840,1850,1860,1860,1870,1880,1880,1890,1890,1890,1900,1900,1900,1910,1910,1910,1910,1910,1910,1910,1910,1910,1900,1900,1900,1900,1890,1890,1890,1880,1880,1870,1870,1860,1850,1850,1840,1830,1830,1820,1810,1800,1800,1790,1780,1770,1760,1750,1740,1720,1710,1700,1690,1680,1660,1650,1640,1630,1610,1600,1590,1570,1550,1540,1520,1510,1490,1470,1460,1440,1420,1410,1390,1370,1350,1330,1310,1240,1290,1280,1250,1220,1200,1180,1160,1140,1110,1090,1070,1050,1030,1010,980,960,940,920,890,870,850,820,810,780,760,740,710,690,670,640,620,600,580,560,530,510,490,460,440,420,400,380,360,340,320,300,280,260,250,230,210,200,180,170,150,140,130,110,100,90,80,70,60,50,40,40,30,20,20,20,10,10,10,10,0,0,0,0,10,10,10,20,20,30]

y = [3220,3160,3180,3200,3230,3250,3270,3290,3300,3320,3340,3360,3390,3440,3480,3500,3520,3550,3580,3610,3640,3670,3710,3740,3780,3840,3880,3910,3950,4000,4050,4090,4140,4190,4250,4310,4390,4440,4490,4540,4600,4600,4590,4560,4540,4510,4470,4440,4420,4400,4390,4360,4370,4390,4410,4420,4450,4470,4490,4500,4500,4500,4510,4500,4490,4470,4450,4430,4400,4390,4380,4380,4390,4390,4390,4410,4420,4430,4440,4460,4470,4470,4470,4460,4450,4440,4430,4410,4400,4390,4360,4340,4350,4350,4360,4370,4380,4400,4410,4420,4440,4450,4460,4460,4450,4440,4430,4410,4400,4380,4370,4360,4360,4350,4360,4370,4380,4400,4420,4420,4390,4370,4360,4350,4340,4330,4300,4290,4290,4300,4290,4260,4230,4200,4160,4150,4140,4140,4110,4100,4090,4070,4040,4010,3990,3950,3920,3910,3900,3870,3850,3830,3780,3740,3680,3630,3590,3560,3520,3470,3430,3380,3330,3270,3220,3160,3110,3070,3030,2970,2920,2870,2870,2890,2920,2940,2980,3000,3010,3020,3030,3040,3050,3040,2940,3020,3000,2970,2920,2920,2920,2920,2910,2910,2920,2930,2950,2970,2990,3010,3010,3010,3000,3000,3000,2990,2970,2950,2930,2910,2890,2890,2900,2910,2920,2920,2930,2950,2960,2990,3010,3030,3030,3020,3010,3000,2990,2980,2970,2970,2960,2950,2950,2950,2960,2970,2990,3010,3020,3040,3040,3050,3060,3070,3070,3060,3050,3040,3030,3020,3020,3010,3010,3010,3010,3020,3020,3030,3050,3060,3080,3120,3160,3170,3170,3160,3160,3160,3170]

enter image description here

enter image description here

CodePudding user response:

min(zip(y, x))

That would produce the y and the x coordinate of the point with the smallest y coordinate.

CodePudding user response:

I would slice X to the window in question and then take min Y of that then find max for X to get to the "last point" before increase. For example:

import pandas as pd
x = [50,30,40,40,60,70,80,90,100,110,120,130,140,160,170,180,200,210,220,240,250,270,280,300,320,340,350,370,390,410,430,450,470,490,510,530,550,570,590,610,620,650,670,690,710,730,760,780,800,820,840,860,890,910,930,950,980,1000,1020,1040,1060,1090,1110,1130,1150,1170,1200,1220,1240,1260,1280,1300,1320,1340,1360,1380,1400,1420,1440,1460,1480,1500,1510,1530,1550,1570,1590,1600,1620,1630,1650,1660,1680,1690,1710,1720,1730,1740,1760,1770,1780,1790,1800,1810,1820,1830,1830,1840,1850,1860,1860,1870,1880,1880,1890,1890,1890,1900,1900,1900,1910,1910,1910,1910,1910,1910,1910,1910,1910,1900,1900,1900,1900,1890,1890,1890,1880,1880,1870,1870,1860,1850,1850,1840,1830,1830,1820,1810,1800,1800,1790,1780,1770,1760,1750,1740,1720,1710,1700,1690,1680,1660,1650,1640,1630,1610,1600,1590,1570,1550,1540,1520,1510,1490,1470,1460,1440,1420,1410,1390,1370,1350,1330,1310,1240,1290,1280,1250,1220,1200,1180,1160,1140,1110,1090,1070,1050,1030,1010,980,960,940,920,890,870,850,820,810,780,760,740,710,690,670,640,620,600,580,560,530,510,490,460,440,420,400,380,360,340,320,300,280,260,250,230,210,200,180,170,150,140,130,110,100,90,80,70,60,50,40,40,30,20,20,20,10,10,10,10,0,0,0,0,10,10,10,20,20,30]
y = [3220,3160,3180,3200,3230,3250,3270,3290,3300,3320,3340,3360,3390,3440,3480,3500,3520,3550,3580,3610,3640,3670,3710,3740,3780,3840,3880,3910,3950,4000,4050,4090,4140,4190,4250,4310,4390,4440,4490,4540,4600,4600,4590,4560,4540,4510,4470,4440,4420,4400,4390,4360,4370,4390,4410,4420,4450,4470,4490,4500,4500,4500,4510,4500,4490,4470,4450,4430,4400,4390,4380,4380,4390,4390,4390,4410,4420,4430,4440,4460,4470,4470,4470,4460,4450,4440,4430,4410,4400,4390,4360,4340,4350,4350,4360,4370,4380,4400,4410,4420,4440,4450,4460,4460,4450,4440,4430,4410,4400,4380,4370,4360,4360,4350,4360,4370,4380,4400,4420,4420,4390,4370,4360,4350,4340,4330,4300,4290,4290,4300,4290,4260,4230,4200,4160,4150,4140,4140,4110,4100,4090,4070,4040,4010,3990,3950,3920,3910,3900,3870,3850,3830,3780,3740,3680,3630,3590,3560,3520,3470,3430,3380,3330,3270,3220,3160,3110,3070,3030,2970,2920,2870,2870,2890,2920,2940,2980,3000,3010,3020,3030,3040,3050,3040,2940,3020,3000,2970,2920,2920,2920,2920,2910,2910,2920,2930,2950,2970,2990,3010,3010,3010,3000,3000,3000,2990,2970,2950,2930,2910,2890,2890,2900,2910,2920,2920,2930,2950,2960,2990,3010,3030,3030,3020,3010,3000,2990,2980,2970,2970,2960,2950,2950,2950,2960,2970,2990,3010,3020,3040,3040,3050,3060,3070,3070,3060,3050,3040,3030,3020,3020,3010,3010,3010,3010,3020,3020,3030,3050,3060,3080,3120,3160,3170,3170,3160,3160,3160,3170]

### create dataframe with dummy data
df = pd.DataFrame({"x":x , "y":y})

### slice to window of interest
df_sliced = df[(df.x > 1300) & (df.x < 1700)]

### get min Y coordinate
y = df_sliced.y.min()

### print to see where this Y coordinate is
df_sliced[df_sliced.y == y]

produces:

enter image description here

### get last X point before increase =
x = df_sliced[df_sliced.y == y].x.max()

### print X Y tuple
(x,y)

enter image description here

  • Related