![]() There are similar questions to this on stack exchange e.g. My question is: how do I most efficiently (and ideally straightforwardly) compute all the chi-squared values on the grid (using numpy to vectorise the equations)? I am open to other ideas, but the most obvious solution seems to be to vectorise the problem using numpy arrays. I would like to find a faster way to do the calculations. This can easily be achieved using for loops, but this is quite inefficient. I would like to calculate the value of chi-squared for each pair of values on the grid (using fixed values for the parameters not spanned by the grid i.e. I might want to consider the grid of values where A ranges over and w ranges over. I would now like to consider a discrete 2-dimensional grid ranging over some set of values of any 2 parameters from A, w, phi, c e.g. I have defined a chi-squared function and used to fit the model to the data. I have some data consisting of 3 1-dimensional arrays of length N: x, y, y_errors, which I am modelling with A*sin(w*x+phi)+c. Novemchi-squared, numpy, python, vectorization
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |