Saravanan666/pypi-org huggingface dataset:
Package: tomodachi-testcontainers
Tomodachi TestcontainersTomodachi Testcontainers is a Python library built on top oftestcontainers-python.
It providesTestcontainers,pytest fixtures,
andtest clientsfor convenient use of Testcontainers withpytestand testing applications built with thePython Tomodachi framework.This library was created to explore and learn Testcontainers. Although initially intended to be used with the Tomodachi framework,
it works for testing applications built with any other Python framework like Flask, FastAPI, Django, etc.What is Testcontainers?Testcontainers is an open-source framework for providing throwaway,
lightweight instances of databases, message brokers, web browsers, or just about anything that can run in a Docker container.
It facilitates the use of Docker containers for functional, integration, and end-to-end testing.
—https://testcontainers.com/To learn more about what Testcontainers are and what problems they solve,
take a look at the Getting Started guide in the official Testcontainers documentation -https://testcontainers.com/getting-started/DocumentationFind documentation athttps://filipsnastins.github.io/tomodachi-testcontainers/The official Testcontainers documentation is athttps://testcontainers.com/InstallationInstall withpip:pipinstalltomodachi-testcontainersInstall withPoetry:poetryadd--groupdevtomodachi-testcontainersFind a list of extras in theinstallation reference.A Simple ExampleThehello, worldTomodachi service:# src/hello.pyimporttomodachifromaiohttpimportwebclassService(tomodachi.Service):@tomodachi.http("GET",r"/hello/?")asyncdefhello(self,request:web.Request)->web.Response:name=request.query.get("name","world")returnweb.json_response({"message":f"Hello,{name}!"})testcontainer_imagefixture builds a Docker image with a Dockerfile from the current working directory.tomodachi_containerfixture starts a new Docker container running thehelloservice on a randomly available port.test_hello_testcontainerssends aGET /hello?name=Testcontainersrequest to the running container and asserts the response.# tests/test_hello.pyfromtypingimportGenerator,castimporthttpximportpytestfromtomodachi_testcontainersimportTomodachiContainer@pytest.fixture(scope="session")deftomodachi_container(testcontainer_image:str)->Generator[TomodachiContainer,None,None]:withTomodachiContainer(testcontainer_image).with_command("tomodachi run readme/hello.py --production")ascontainer:yieldcast(TomodachiContainer,container)@pytest.mark.asyncio()asyncdeftest_hello_testcontainers(tomodachi_container:TomodachiContainer)->None:asyncwithhttpx.AsyncClient(base_url=tomodachi_container.get_external_url())asclient:response=awaitclient.get("/hello",params={"name":"Testcontainers"})assertresponse.status_code==200assertresponse.json()=={"message":"Hello, Testcontainers!"}LinksDocumentation:https://filipsnastins.github.io/tomodachi-testcontainers/Releases and Changelog:https://github.com/filipsnastins/tomodachi-testcontainers/releasesPyPI:https://pypi.org/project/tomodachi-testcontainers/Source Code:https://github.com/filipsnastins/tomodachi-testcontainersReference - Code API:https://filipsnastins.github.io/tomodachi-testcontainers/reference/
Package: tomogram-shift-alignment
tomogram_shift_alignmentOutlineDifferent tomogram generation and/or reconstruction techniques often generate tomograms with slightly different coordinates. This makes comparing the attainable resolution of the structure from these tomograms difficult. This program compares the shifts between two of the same tomogram which were constructed by different methods, and adjusts the particle coordinates of a star file to fit the new tomogram.This is designed for RELION v4.0 star files. The generated star file should be imported into RELION 4.0 using Import Coordinates.Installation and UsageRequirementsPython (3.0 or later)Installation is carried out via:pipinstalltomogram_shift_alignmentInvoke from the command line via typing:tomogram_shift_alignment[original_tomograms][new_tomograms][particles_star][tomogram_binning][Optional:tomogram_trimming]e.g.

tomogram_shift_alignment'./tomograms''./new_tomograms''./run_data.star'860Where original_tomograms is the path to directory containing original tomograms where particles were picked. New tomograms is the path to directory containing new tomograms where the coordinates don't match. particles_star is a star file containing refinemed particle positions and angles. Tomogram binning is the binning level of the tomograms. An optional input is tomogram_trimming which is the number (in percent) to trim the tomograms by from the outer edges. This is to avoid comparison of the tomograms in empty space. Default is 40%. Use a higher value if your sample is perfectly centred in the tomogram and vice versa.
Package: tomograph
tomograph - paramterized computer tomography simulatortomographis a parametrized computer tomography simulator, which can be run as
a standalone script or included as a module in your Python programs. It
implements both Radon and reverse Radon transforms. It currently models two
types of beam projections: cone and parallel.DependenciesCurrentlytomographrequires:Click (click)tqdm (tqdm)NumPy (numpy)Image Processing SciKit (scikit-image)Their respective required versions can be seen inrequirements.txtfile.InstallationSimply run:pip install tomographTomograph supports Python 3.5, Python 3.6 and Python 3.7.Usagetomographcan be used directly through command-line interface or as a Python
module:CommandlineUsing command-line interface:tomograph --model cone --detectors 256 --angle 150 --rotations 512 image.jpgAll command-line arguments can be seen by running:tomograph --helpModuleExample script that does Radon transform using cone beam model:from skimage.io import imsave
from tomograph.model import ConeTomograph

# variables
path = 'image.jpg'
detectors = 256
angle = 180
rotations = 512

# one scan per rotation
step = 360 / rotations

# perform Radon transform
tomograph = ConeTomograph(path, detectors, angle)
sinogram = []
for i in range(rotations):
    tomograph.rotate(step)  # rotate tomograph
    scan = tomograph.scan() # do the scan
    sinogram.append(scan)

imsave('radon.bmp', np.array(sinogram).T)Live demonstrationBeam linesRadon transformreverse Radon transform
Package: tomographer
The Python interface to Tomographer allows you to easily perform reliable
quantum tomography in a Python environment.Documentation is providedhere.InstallationIn order to install this Python extension, you need a relatively recent C++ compiler
(supporting C++11), such asg++≥ 4.8 orllvm/clang≥ 3.3.The easiest way to installtomographeris usingpip:pip install numpy pybind11
pip install tomographerNOTE:pipcannot (apparently) install build-time requirements, so you have
to installnumpyandpybind11manually, before installingtomographer.LicenseThe Tomographer project is licensed under the MIT license, see LICENSE.txt.Note: This package contains a subset of theBoost library(distributed under theBoost software license)
and theEigen3 library(distributed under theMPL license 2.0).
They are located in the source package directorytomographer/include/deps/.
Package: tomography-tutorial
EO-College tomography tutorialThis tutorial, developed by theEO-Collegelearning initiative,
explores Synthetic Aperture Radar (SAR) tomography
with data from DLR'sF-SARsystem.
It consists of a Python package, containing several functions for processing and displaying the data,
a Jupyter notebook, a test data set, which can be downloadedhere, and avideo tutorial.Please follow the steps below to get started.InstallationThe following subsections describe the installation process for different operating systems.
Please mind that this tutorial depends on Python 3.UbuntuFirst we want to installGDALto read our data. For this we add theUbuntuGISpackage
repository so we can install a more recent version than that supplied by Ubuntu.
After this we install GDAL together with its Python bindings:sudoadd-apt-repositoryppa:ubuntugis/ppa
sudoapt-getupdate
sudoapt-getinstallgdal-binpython3-gdalNext we install Tkinter for graphical support:sudoapt-getinstallpython3-tkAs a last step we install the tomography module including its direct Python package
dependencies:sudopython3-mpipinstalltomography_tutorialWindowsThe easiest way to install Python and Jupyter on Windows is viaAnaconda.
Please make sure to install the Python 3 version.Once you have installed it, please add its installation directory to the PATH environment variable.
See e.g.herefor instructions.
Now we can install GDAL via Anaconda's own command line installation program:condainstall-ccondagdalFinally we can install the tutorial package:python-mpipinstalltomography_tutorialdownload of tutorial test dataPrior to starting the tutorial you need to download and unpack the data foundhere.Starting the notebookNow that everything is installed you can start the notebook via the tutorial Python module.
In the command prompt, start Python and execute the functionstart:fromtomography_tutorialimportstartstart('/your/custom/notebook.ipynb')This will create a custom copy of the notebook if it does not yet exist and start it in the browser.
If the directory in which the custom notebook is to be stored does not yet exist, it is created
automatically. Please mind that under Windows paths need to be separated with\\or/,
a single backslash will cause an error.You now have a custom version of the tutorial,
which you can modify as you like and restart later via functionstart.If you want to restore the original notebook, which was delivered with the Python package, just delete
your custom version and run functionstartagain.API documentationThe documentation of the package functionality which is used in the notebook can be foundhere.
Package: tomogui
Tomogui offers a Graphical User Interface to run tomographic reconstruction based on freeart (https://gitlab.esrf.fr/freeart/freeart) and silx (https://github.com/silx-kit/silx) algorithmsInstallationpip install tomoguiUsageTomogui contains two main applications:tomogui project : to create a new project from scratchtomogui recons : to run reconstruction from a configuration file created by ‘tomogui project’See more indocumentation.DocumentationDocumentation of latest release is available athttp://www.edna-site.org/pub/doc/tomogui/latestLicenseThe source code of tomogui is licensed under the MIT license.
See theLICENSEandcopyrightfiles for details.
Package: tomorrow
Magic decorator syntax for asynchronous code in PythonInstallationTomorrow is conveniently available via pip:pip install tomorrowor installable viagit cloneandsetup.pygit clone git@github.com:madisonmay/Tomorrow.git
sudo python setup.py installUsageThe tomorrow library enables you to utilize the benefits of
multi-threading with minimal concern about the implementation details.Behind the scenes, the library is a thin wrapper around theFutureobject inconcurrent.futuresthat resolves theFuturewhenever
you try to access any of its attributes.Enough of the implementation details, let’s take a look at how simple it
is to speed up an inefficient chunk of blocking code with minimal
effort.Naive Web ScraperYou’ve collected a list of urls and are looking to download the HTML of
the lot. The following is a perfectly reasonable first stab at solving
the task.For the following examples, we’ll be using the top sites from the Alexa
rankings.urls=['http://google.com','http://facebook.com','http://youtube.com','http://baidu.com','http://yahoo.com',]Right then, let’s get on to the code.importtimeimportrequestsdefdownload(url):returnrequests.get(url)if__name__=="__main__":start=time.time()responses=[download(url)forurlinurls]html=[response.textforresponseinresponses]end=time.time()print"Time:%fseconds"%(end-start)More Efficient Web ScraperUsing tomorrow’s decorator syntax, we can define a function that
executes in multiple threads. Individual calls todownloadare
non-blocking, but we can largely ignore this fact and write code
identically to how we would in a synchronous paradigm.importtimeimportrequestsfromtomorrowimportthreads@threads(5)defdownload(url):returnrequests.get(url)if__name__=="__main__":importtimestart=time.time()responses=[download(url)forurlinurls]html=[response.textforresponseinresponses]end=time.time()print"Time:%fseconds"%(end-start)Awesome! With a single line of additional code (and no explicit
threading logic) we can now download websites ~10x as efficiently.You can also optionally pass in a timeout argument, to prevent hanging
on a task that is not guaranteed to return.importtimefromtomorrowimportthreads@threads(1,timeout=0.1)defraises_timeout_error():time.sleep(1)if__name__=="__main__":printraises_timeout_error()How Does it Work?Feel free to read the source for a peek behind the scenes – it’s less
that 50 lines of code.
Package: tomorrow-io
Tomorrow_ioProvides a wrapper layer for interfacing withTomorrow.io.
This is not an official package, and is primarily written for use inHomeAssistantplugins.UseageYou will need to get an API key from Tomorrow.io.Sign up,
then navigate to thekeyspage to get your API key.
Note that the free plan limits you to 500 requests/day and 25 requests/hour.Once you have an API key, you can simply create aTomorrowobject, and start pinging the API.
A few examples follow.ExamplesDefaultsBy default, the package assumes you want to know about Iowa State University. You can change that by
passing thelongitudeandlatutudearguments to any of Tomorrow's functions. To set your own defaults,
pass them to the__init__call. For prettymuch everything else, it assumes you want to follow Tomorrow.io's
defaults, from theirAPI docs.Get the current temperaturefromtomorrow_ioimportTomorrowapikey='YOUR_API_KEY'tomorrow=Tomorrow(apikey)tomorrow.get_current(data_fields=['temperature'])Set a default locationfromtomorrow_ioimportTomorrowapikey='YOUR_API_KEY'# Check in on the Hawkeyes, may they always have rain on gameday!tomorrow=Tomorrow(apikey,longitude=-91.5549009294,latitude=41.6626978351)tomorrow.get_current(data_fields=['weatherCode'])Note that we can still override the default location by passing latitude and/or longitude any of the functions
ofTomorrow.data_fieldsTo get the information you want, you have to ask for it. Tomorrow.io supports numerous data fields, so I won't
list them all, but some of the most common ones are below. A full list can be foundheretemperature
temperatureApparent
humidity
precipitationProbability
precipitationType
cloudCover
weatherCode
epaIndex
epaHealthConcern
weedIndex
grassIndex
treeIndexFAQWhy bother with this though? Aren't API calls pretty easy?Yep. The only real reason this exists is to facilitate Home Assistant plugin development.
They require that API calls be wrapped in a library, available on PyPi.SourceWhy black? That makes all this code look really dumb!Yeah, I agree. Trying it out, since the Home Assistant project uses it, and I figured I should get used to it.Pip install fails withfile not foud: setup.pyor similarYour pip is out of data.pip install --upgrade pip(requires at least pip version 19,link)This FAQ seems like a list of reasons not to use thisYes it does, doesn't it?
Package: tomotok
TomotokFramework for tomographic inversion of fusion plasmas focusing on inversion methods based on discretisation. Structured as a namespace package to ease implementation on different experiments and for various diagnostics.CoreThe documentation for the Core can be found on thislink.The Core package of Tomotok implements various discretization algorithm that are used for tomography of tokamak plasma.
It is required by specific packages that can create automated database access for a given fusion experimental device and ease the routine tomography computation.
Together with the Core package, simple GUI for result analysis is distributed.InversionsThe algorithms take numpy.ndarrays or scipy.sparse matrix objects as input to be able to run independently on the rest of the package in order to promote interoperability with other codes (e.g.ToFu)Currently implemented algorithms:Minimum Fisher Regularisation for sparse matrices using scipy.sparse.linalg.spsolveMinimum Fisher Regularisation for sparse matrices using cholesky decomposition from scikit.sparseSVD linear algebraic inversion for dense matricesGEV linear algebraic inversion with optimization for sparse matricesBiorthogonal Basis decomposition for dense matricesBiorthogonal Basis decomposition optimized for sparse matrices (scipy, cholmod)Auxiliary featuresApart from the main inversion methods some auxiliary features are also included.
In order to make routine computation of inversions a database interface was designed using template classes. These can load signals, detector view geometry and magnetic flux reconstruction in format usually used for tokamak data.Simple synthetic diagnostic framework is also implemented. It can be used for testing the implemented algorithms. It uses regular rectangular nodes and assumption of toroidal symmetry as it is the simplest case often used for inversions of tokamak plasma radiation.Implemented auxiliary features:Template classes for automated database interfaceGeometry matrix computation using numerical integration and single line of sight approximationSmoothing matrix computation, both isotropic and anisotropic (based on magnetic flux surfaces)Simple phantom model generators (isotropic and anisotropic)Other tools for processingGraphical user interfaceSimple graphical user interface for visualisation and post-processing of tomography results is included in the Core package. It is based on modular system of windows. It uses main window to spawn child windows for analysis to customize displayed information based on user needs.Citing the Code"J. Svoboda, J. Cavalier, O.Ficker, M. Imrisek, J. Mlynar and M. Hron,Tomotok: python package for tomography of tokamak plasma radiation, Journal of Instrumentation 16.12 (2021): C12015."DOI
Package: tomplotlib
tomplotlibtomplotlibis Tom's wrapper formatplotlib.
This package will style your plots and define some useful functions, including a function for automated saving of figures labelled by date and time. The main code is found in./tomplotlib/tpl.pyInstallationTo install, runpip install tomplotlibAlternatively, clone this directory and then run:python setup.py install(install in edit modepip install -e .if you wish the edit the code.)ImportingImporttomplotlibinto your code with: /import tomplotlib as tplset's most of the required style parameters.Usagetpl.save_figure(fig)This, in my opinion, is the most useful function. By defining a figure directory (tpl.figure_directory = "where_to_save_my/Figures/"), you can calltpl.save_figure(fig, `figureName`)on anymatplotlibfigure or animation object. This will timestamp the figure and save it in the figure directory (which will be made if it doesn't already exist), inside another directory which is the todays days date. By default images will be saved as.pngs and.svgs, If an animation object if passed this will be saved as'.gif'and'.mp4'.import tomplotlib as tpl 
tpl.figure_directory = "./Figures/"
fig, ax = #some code which makes a maplotlib figure
tpl.save_figure(fig,"fig_name")tpl.xy_axes(ax)Tidies the axes, leaving only x and y axes at zero.tpl.set_colorscheme(colorscheme)sets the colour schemetpl.set_colorscheme(colorscheme=1)
fig, ax = #some code which makes a matplotlib figure

tpl.set_colorscheme(colorscheme=2)
fig, ax = #some code which makes a matplotlib figure

tpl.set_colorscheme(colorscheme='Set3')
fig, ax = #some code which makes a matplotlib figure

tpl.set_colorscheme(colorscheme=[[0.9,0.9,0.9],[0.75,0.75,0.75],[0.6,0.6,0.6],[0.45,0.45,0.45],[0.3,0.3,0.3],[0.15,0.15,0.15],[0,0,0]])
fig, ax = #some code which makes a matplotlib figureYou passcolorschemeas anint(schemes I have defined), asstr(matplotlib schemes, seehere) or as alistof colors (e.g. list of hexstrings). These will become C0, C1, C2...
Package: tompoes
It is impossible to properly install this package in buildout 1.6.x.This package installs fine with pip.>>> pip install tompoes
>>> tom
setup(script=['bin/tom']) works!
>>> tom_main
entry_points console_scripts works!However it is not possible to properly install it in a buildout.::>>> python bootstrap.py
>>> ./bin/buildout -v
>>> ./bin/tom
-bash: ./bin/tom: No such file or directory
>>> ./bin/tom_main
"entry_points console_scripts works!"Seems like a problem in buildout.easy_install.
Package: toms
toms - unix timestamp converterFeatures:Convert unix epoch millis to UTC iso dateConvert UTC iso date to unix epoch millisRead from stdinReplace all occurrences of unix epoch millis with iso date in textPrint current time millisinstallpip3 install tomsexamplesConvert unix epoch millis to UTC iso datetoms 1500000000000
2017-07-14T02:40:00+00:00Convert UTC iso date to unix epoch millistoms 2017-07-14T02:40
1500000000000Read from stdinecho '2019-01-01 2020-01-01T10:12' | toms
1546300800000
1577873520000Replace all occurrences of unix epoch millis with iso date in textecho 'text 1500000000000 text' > /tmp/some-text.txt
cat /tmp/some-text.txt | toms replace
text 2017-07-14T02:40:00+00:00 textPrint current time millistoms now
1592335604695
Package: tomsbestfriend
Tom’s Best Friend is aTOMLparser for
people with deadlines. No, sorry. For humans. No, dammit, all the good taglines
are taken.>>>frompprintimportpprint>>>fromtomsbestfriendimportloads>>>pprint(...loads(..."""
...     [cartoons]
...     characters = ["filbert", "heffer"]
...     hilarious = true
...
...     [cartoons.info]
...     episodes = 52
...     """...)...){'cartoons':{'characters':[u'filbert',u'heffer'],'hilarious':True,'info':{'episodes':52}}}ContributingI’m Julian Berman.TomsBestFriendis onGitHub.Get in touch, via GitHub or otherwise, if you’ve got something to contribute,
it’d be most welcome!You can also generally find me on Freenode (nick:tos9) in various
channels, including#python.