611,763 research outputs found

    Simplifying Parallelization of Scientific Codes by a Function-Centric Approach in Python

    Full text link
    The purpose of this paper is to show how existing scientific software can be parallelized using a separate thin layer of Python code where all parallel communication is implemented. We provide specific examples on such layers of code, and these examples may act as templates for parallelizing a wide set of serial scientific codes. The use of Python for parallelization is motivated by the fact that the language is well suited for reusing existing serial codes programmed in other languages. The extreme flexibility of Python with regard to handling functions makes it very easy to wrap up decomposed computational tasks of a serial scientific application as Python functions. Many parallelization-specific components can be implemented as generic Python functions, which may take as input those functions that perform concrete computational tasks. The overall programming effort needed by this parallelization approach is rather limited, and the resulting parallel Python scripts have a compact and clean structure. The usefulness of the parallelization approach is exemplified by three different classes of applications in natural and social sciences.Comment: 29 pages, submitted to Computational Science and Discover

    Pytrec_eval: An Extremely Fast Python Interface to trec_eval

    Full text link
    We introduce pytrec_eval, a Python interface to the tree_eval information retrieval evaluation toolkit. pytrec_eval exposes the reference implementations of trec_eval within Python as a native extension. We show that pytrec_eval is around one order of magnitude faster than invoking trec_eval as a sub process from within Python. Compared to a native Python implementation of NDCG, pytrec_eval is twice as fast for practically-sized rankings. Finally, we demonstrate its effectiveness in an application where pytrec_eval is combined with Pyndri and the OpenAI Gym where query expansion is learned using Q-learning.Comment: SIGIR '18. The 41st International ACM SIGIR Conference on Research & Development in Information Retrieva

    Python for education: permutations

    Get PDF
    Python implementation of permutations is presented. Three classes are introduced: Perm for permutations, Group for permutation groups, and PermError to report any errors for both classes. The class Perm is based on Python dictionaries and utilize cycle notation. The methods of calculation for the perm order, parity, ranking and unranking are given. A random permutation generation is also shown. The class Group is very simple and it is also based on dictionaries. It is mainly the presentation of the permutation groups interface with methods for the group order, subgroups (normalizer, centralizer, center, stabilizer), orbits, and several tests. The corresponding Python code is contained in the modules perms and groups.Comment: 26 pages, 1 figure, 2 table

    Python bindings for the open source electromagnetic simulator Meep

    Get PDF
    Meep is a broadly used open source package for finite-difference time-domain electromagnetic simulations. Python bindings for Meep make it easier to use for researchers and open promising opportunities for integration with other packages in the Python ecosystem. As this project shows, implementing Python-Meep offers benefits for specific disciplines and for the wider research community

    Modernizing PHCpack through phcpy

    Full text link
    PHCpack is a large software package for solving systems of polynomial equations. The executable phc is menu driven and file oriented. This paper describes the development of phcpy, a Python interface to PHCpack. Instead of navigating through menus, users of phcpy solve systems in the Python shell or via scripts. Persistent objects replace intermediate files.Comment: Part of the Proceedings of the 6th European Conference on Python in Science (EuroSciPy 2013), Pierre de Buyl and Nelle Varoquaux editors, (2014

    Python I, II, and III CMB Anisotropy Measurement Constraints on Open and Flat-Lambda CDM Cosmogonies

    Full text link
    We use Python I, II, and III cosmic microwave background anisotropy data to constrain cosmogonies. We account for the Python beamwidth and calibration uncertainties. We consider open and spatially-flat-Lambda cold dark matter cosmogonies, with nonrelativistic-mass density parameter Omega_0 in the range 0.1--1, baryonic-mass density parameter Omega_B in the range (0.005--0.029) h^{-2}, and age of the universe t_0 in the range (10--20) Gyr. Marginalizing over all parameters but Omega_0, the combined Python data favors an open (spatially-flat-Lambda) model with Omega_0 simeq 0.2 (0.1). At the 2 sigma confidence level model normalizations deduced from the combined Python data are mostly consistent with those drawn from the DMR, UCSB South Pole 1994, ARGO, MAX 4 and 5, White Dish, and SuZIE data sets.Comment: 20 pages, 7 figures, accepted by Ap
    corecore