1

This is the typical Crop Growth Curve

Typical Crop Growth CUrve

The general equation/function for the sigmoid curve are, as in the function below 1 2

def sigmoid(x):
    y = (1 / (1 + np.exp(-x)))
    return (y)

I want that during any crop period starting from day 1, to nth number of day till the cropping season ends, this sigmoid curve should retain this shape, whatever the crop duration is.

  • (n/crop_end_day - is variable here, which may be 90, 100, 120, 150, etc depending upon the crop type)
crop_start_day = 1
crop_end_day = 120
time_increment = 1
crop_duration = np.arange(crop_start_day,crop_end_day,time_increment)
print(crop_duration)
crop_growth = sigmoid(crop_duration)
print(crop_growth)
plt.plot(crop_duration, crop_growth)
plt.title("Crop Growth Curve")
plt.xlabel("Days")
plt.ylabel("Relative Growth (Dry Matter/Root Growth etc..)")
plt.grid()
plt.show()

The objective is that if the relative growth (0 to 1) is known on any specific day based on this curve,

then the absolute value can be obtained by considering this relative growth as weight i.e. multiplying this relative growth with the maximum possible value of any parameter like root length, dry weight, etc on that specific day...

With the current inputs

crop_start_day = 1
crop_end_day = 120
time_increment = 1

the output is not as desired desired.

as I change the inputs as

crop_start_day = 1
crop_end_day = 10
time_increment = 1

the output is like this, but the relative growth does not start from zero,

enter image description here

and with these inputs, the curve somewhat resembles but crop start day can not be negative

crop_start_day = -10
crop_end_day = 10
time_increment = 1

enter image description here

The sigmoid curve is not obtained in any of the figures, in spite, the function used is same as in the references,

Is there any way to retain the sigmoid curve while changing the number of crop growth days/duration (this is the only variable part)?

Note:

  • The time increment should be one (1) day.

  • No intercept is required as crop growth will start from zero on day 1.

Tried different solutions given for Sigmoid Curve, as in Fit sigmoid function ("S" shape curve) to data using Python, but did not got the results.

import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit

def sigmoidx(x, L ,x0, k, b):
    y = L / (1 + np.exp(-k*(x-x0)))+b
    return (y)

crop_start_day = 0
crop_end_day = 120
time_increment = 1
curve_max_value = 600 # L
sigmoid_midpoint_x0 = 60 # x0
logistic_growth_rate = 5 # k (taken linear 5 units per day)
intercept = 0 # b

crop_duration = np.arange(crop_start_day,crop_end_day,time_increment)
crop_growth = sigmoidx(crop_duration, curve_max_value, sigmoid_midpoint_x0, logistic_growth_rate, intercept)

p0 = [max(crop_growth), np.median(crop_duration), 1, min(crop_growth)] # initial guess

popt, pcov = curve_fit(sigmoidx, crop_duration, crop_growth, p0, method='dogbox')

plt.plot(crop_duration, crop_growth, 'b-', label='data')
desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • "The sigmoid curve is not obtained in any of the figures, in spite, the function used is same as in the references" Yes, it is. That's what sigmoid curves look like. The curve in the first image you show is *not* a sigmoid. Sigmoids have a horizontal asymptote as they go to +/- infinity, [by definition](https://en.wikipedia.org/wiki/Sigmoid_function). Based on that first image, it sounds as if you're actually looking for a [sinusoid](https://en.wikipedia.org/wiki/Sine_wave). – Karl Knechtel Oct 12 '21 at 06:23
  • I’m voting to close this question because it appears to be fundamentally a math question, not a programming question. If you are looking for tools to help you find the right parameters to match your input data, that is also off topic (we don't do those kinds of recommendations here) - try using a search engine. – Karl Knechtel Oct 12 '21 at 06:24
  • Should i delete it? @KarlKnechtel – Abhilash Singh Chauhan Oct 12 '21 at 06:25
  • https://nios.ac.in/media/documents/SrSec314NewE/Lesson-20.pdf – Abhilash Singh Chauhan Oct 12 '21 at 06:26
  • and its not a maths problem though, the crop growth by definition follows the sigmoid curve as in the link above. – Abhilash Singh Chauhan Oct 12 '21 at 06:27
  • Your reference might *call* that a sigmoid curve, but it is *wrong*. The reason your results look the way they do is because that is the only way that curves *can* look simply by adjusting the coefficients for that formula. *Understanding* that fact, is a question about math. – Karl Knechtel Oct 12 '21 at 06:30
  • https://www.nature.com/articles/s41598-018-24705-4 – Abhilash Singh Chauhan Oct 12 '21 at 06:31
  • The name of curve is Sigmoidal only, even in Nature Scientific Reports, what other terminology I am supposed to use then? – Abhilash Singh Chauhan Oct 12 '21 at 06:33
  • It is not clear what you are asking. The final snippet you created is working, you generated a synthetic dataset with specific parameters using the function and then the optimization find those parameters with very good accuracy. It means your procedure is able to fit experimental data to your model and it will be a reasonable adjustment if an experimental dataset comply with the model. What is the exact problem you are facing? – jlandercy Oct 12 '21 at 18:32
  • Suppose in general, I have to estimate/find the root length of any crop on Nth day, but the crops do not grow linearly, they follow the sigmoid curve. So It is simply illogical to say that maximum root length will be obtained on last growing day in a linear manner. – Abhilash Singh Chauhan Oct 12 '21 at 18:38
  • So I wanted a general equation where only crop duration is variable but sigmoid curve retains its shape so that relative growth can be estimated on any nth day during the growing season – Abhilash Singh Chauhan Oct 12 '21 at 18:39
  • Here as soon as I change the value of crop_end_day i.e. duration of crop growth, the shape of curve changes, which is theoretically not correct – Abhilash Singh Chauhan Oct 12 '21 at 18:42
  • I understand why other user think it is math based question. Sigmoid curves are more like a generic category of curves with S shape, there are plenty of them. You have a working procedure at the end of your post for a specific sigmoid (logistic). You can switch for another model such as the one in comment citing Nature article. Your problem is you don't have a mathematical model to represent the crop and you choose the first sigmoid you find out. Once you have selected the correct model you will be able to predict the curve with given parameters or infer parameters from experimental. – jlandercy Oct 12 '21 at 18:44
  • Just think this curve as an imaginary crop/plant, it should follow the growth as cited in literature where it’s only written as sigmoid curve. Considering any crop in general instead of any specific, it should somehow fit in the same manner as described by the sigmoid curve equation. I’m working on something where I just wanted that, whatever the crop growing period (days) is, this general equation should retain the curve shape, so that a value can be estimated on any given day during this crop growing period. – Abhilash Singh Chauhan Oct 12 '21 at 18:50
  • Well, I am just trying to help here. Sigmoid is not as specific curve, it is more like an adjective we apply on curve when they are S shaped. If you take time to do some Math on the equation you parametrized you will see that it cannot have the shape in the first figure of your post. Mainly it saturates and settle and never fall back as time grows. – jlandercy Oct 12 '21 at 18:53
  • The problem is that, the equations given in the literature have a lot of coefficient which are crop specific and I wanted a general equation which may fit and follow the general sigmoid curve with respect to growth of plants/crops, any it may fit any kind of field crop irrespective of its growing duration (which is generally from 60 to 180 days) for field crops. – Abhilash Singh Chauhan Oct 12 '21 at 18:55
  • @jlandercy Thanks a lot for your time. I got your point now. I will dig up some literature for any general equation with respect to crop growth behaviour and try to see them how they perform. – Abhilash Singh Chauhan Oct 12 '21 at 18:58
  • If you find a model that suits better your need and face some problem in adjusting it, feel free to update this post and draw my attention on it. I like to fit data! Have a good day. – jlandercy Oct 12 '21 at 18:59
  • @jlandercy sure sir, appreciate it – Abhilash Singh Chauhan Oct 12 '21 at 19:03

0 Answers0