the function HH_model(x,y) calculates the probability of reaching the threshold. Now I know the output, i.e. the probabilities for certain values of x and want to choose the