Relative Content

Tag Archive for pythonnumpytranslateidl

Converting IDL into Python, Taking Verbatim translation and making it Pythonic

I’m translating some old IDL code into python. I’m very new and hoped (am still hoping) that by jumping into some IDL code I could maybe learn the language faster. I’ve started with what seemed to be the “easiest” function to bring over. This function takes a given “psd” and creates a simulated map from it. Not exactly sure what ‘psd’ stands for but we’re in an astronomical context so its probably safe to assume it means power spectral density… for our purposes this is a 2D array of whatever shape. Before taking some code that generates a fake atmosphere psd, I was using smaller 2×3, 3×4, & 4×4 arrays. Things were going… not exactly well but I was making it further in the code before things broke than I am now. I’ve got pretty limited experience with both IDL and numpy (astropy usually handled a lot of the numpy stuff for me so I never had to directly code new stuff), and so I’m really struggling to figure out just WHAT is wrong. The problem with fixing this arises because I have NO CLUE what parts of the IDL code need to stay in python.