<jupyter_start><jupyter_text>idlwrap<jupyter_code>import idlwrap

idlwrap.indgen(3, 4)<jupyter_output><empty_output><jupyter_text>*idlwrap* aims to abstract away all differences in IDL and python and provide the interface and functions you know from IDL, but using `scipy` and `numpy` under the hood. It helps you transitionning from IDL to python by providing all the little things which are special about IDL — but being powered entirely by python.> No IDL is required to run *idlwrap*, as it is pure python! what does idlwrap do?Let's see what *idlwrap* does by looking at an example. This piece of code is taken directly from the *idlwrap* source code:``` pythondef round(x):    return np.trunc(x+np.copysign(0.5,x)).astype(int)```The `idlwrap.round()` replicates the behaviour of IDL's `ROUND` function, by using `numpy` internally. In IDL, `ROUND` uses **half-away-from-zero**, meaning that `3.5` is rounded to `4`, and `4.5` is rounded to `5`:``` IDLIDL> PRINT, ROUND(3.5), ROUND(4.5), ROUND(5.5), ROUND(6.5)           4           5           6           7```Whereas in python/numpy, rounding works differently: they round **half-to-even**, as defined in the IEEE-754 standard, meaning both `3.5` and `4.5` are rounded to `4`:<jupyter_code>import numpy as np
np.round(3.5), np.round(4.5), np.round(5.5), np.round(6.5)<jupyter_output><empty_output><jupyter_text>Now, you do not have to worry about these little beasts when porting an old IDL codebase to python. We worried about that already! Just `import idlwrap` and you're ready to go!With *idlwrap*, you'd just write<jupyter_code>idlwrap.round(3.5), idlwrap.round(4.5), idlwrap.round(5.5), idlwrap.round(6.5)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11896348645465253, 'fraction_numerical': 0.027090694935217905, 'mean_word_length': 4.798634812286689, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '366696', 'license': 'MIT', 'n_tokens_mistral': 595, 'n_tokens_neox': 570, 'n_words': 207, 'path': 'docs/notebooks/00.index.ipynb', 'repo_name': 'r4lv/idlwrap', 'size': '1698'}