You already have a valid stepped mapping from shape[0]
to w
.
If you would like to change that mapping to be more continuous you could use, e.g.
w = min(MAXVAL, max(MINVAL,SLOPE*shape[0]))
which will create a ramp between at least MINVAL and at most MAXVAL with gradient SLOPE.
E.g. using MAXVAL = 80
, MINVAL = 20
, and SLOPE = 0.5
gives