Saravanan666/pypi-org huggingface dataset:
Package: dtwmetrics
dtw_metricsDynamic time warping metrics.DescriptionDynamic time warping (DTW) is an algorithm used to measure similarity between different data series, which may vary in speed.SetupMakefileSetup via Makefile:Clone the repository first.Help and overview of commands:makehelpSetup (Create the venv, install libraries and pull minimal data setup):makesetupActivate Python venv:makevenvClean project:makecleanPython venv (Poetry)Poetry is used for the virtual Python environment.Installpython poetry:curl-sSLhttps://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py|pythonorpipinstall--userpoetryMake sure that the virtual environment is installed in the root folder of this projects:poetryconfigvirtualenvs.in-projecttrueInstall dependencies:poetryinstall--no-rootAdd packages:
To add further packages, run:poetryadd<package-name>Code formattingFormatting via pre-commit hook:
Python code is formatted using pre-commit hooks.Install pre-commit:pipinstallpre-commitorbrewinstallpre-commitInstall pre-commit hooks from the config file .pre-commit-config.yamlpre-commitinstallRun the pre-commit hooks:pre-commitrun-aCode testingTesting is done withpytest. The pytest package is already installed in the poetry venv.Run all tests:pytestRun individual tests:pytest<path-to-test-files>UsageExample files in/examples/ExamplesSymmetric P1 step patternFig 1: Compared time series and warped sequence.Fig 2: Cost matrix and optimal warping path.Fig 3: Accumulated cost matrix and optimal warping path.Symmetric P0 step patternFig 1: Compared time series and warped sequence.Fig 2: Cost matrix and optimal warping path.Fig 3: Accumulated cost matrix and optimal warping path.ReferencesMüller, Meinard. Information retrieval for music and motion. Vol. 2. Heidelberg: Springer, 2007.https://doi.org/10.1007/978-3-540-74048-3
Package: dtw-sofar
dtw-sofarOverviewThis library implements the "Dynamic Time Warping Algorithm" for multimodal research in a way it can warp the time series received "so far." In other words, it modifies the dynamic time warping algorithm to be compatible with 'iterative stimuli' (when future points in the time series are received one by one).One motivating application is aligning natural language annotations and video frames for research on Visual Language Models (e.g.CLIP by OpenAI), when the latter's embeddings are received frame by frame (e.g. we're making observations and don't have access to future frames). With "dtw-sofar," we can predict optimally matching annotations to new video frames on the fly - by relying on temporal information available "so far."Development and ContributionsFor development details and contribution instructions, please refer to thecontribution guidelines.Installation:First, install Python 3.7 (or later) and numpy, and then install this repo as a Python package.$pipinstallnumpy
$pipinstalldtw-sofarQuick Start Examples:Below is a sample use-case for quick start:importimportlibimportnumpyasnpdtwsofar=importlib.import_module('dtw-sofar.dtw_sofar')video_features=np.load('CLIP_video_embeddings_path')text_features=np.load('CLIP_text_embeddings_path')# iterates over each RGB frame's CLIP embeddings and classifies matching text embeddings on-the-fly:final_path,dtw_matrix,onthefly_predictions,onthefly_path=dtwsofar.dtw_onthefly_classification(video_features,text_features)This use case demonstrates performing dynamic time warping so-far on image and natural language embeddings from Open AI's CLIP Model, so as to align them. See the overview for relevance.This library can also be used for simpler time-series:# time-series to be aligned with dynamic time warping "so far":time_series_a=np.random.rand(100,1)time_series_b=np.random.rand(35,1)final_path,dtw_matrix,onthefly_alignment,onthefly_path=dtwsofar.dtw_onthefly_classification(time_series_a,time_series_b)
Package: dtxg
dtxg - powerful extensions to dateutilThedtxgmodule provides powerful extensions to
the standarddateutilmodule, available in Python.Installationdtxgcan be installed from PyPI usingpip:pip install dtxgDownloaddtxg is available on PyPIhttps://pypi.org/project/dtxg/CodeThe code and issue tracker are hosted on Github:https://github.com/yangsongbai1/dtxg/FeaturesExtensions to the dateutil module to support time resolution in multiple languagesUtc time can be returned based on the time zone parameterContributingWe welcome many types of contributions - bug reports, pull requests (code, infrastructure or documentation fixes). For more information about how to contribute to the project, see theCONTRIBUTING.mdfile in the repository.
Package: dty
DTY (Directory-to-YAML)OverviewDTY (Directory-to-YAML) is a Python command-line tool designed for quickly generating representations of directory structures and their contents in YAML format. This tool is especially useful for structuring directory data in a token-efficient manner, making it ideal for interactions with language models like ChatGPT.Example outputdtymy_project:__init__.py:""main.py:|# Main application fileimport appapp.run()app.py:|# App moduledef run():print('Running the app')utils:helper.py:|# Utility functionsdef helper():return 'Helper function'FeaturesConvert directory contents to YAML format.Include or exclude files using patterns (supports fnmatch style, e.g.,*.py,data*).Recursive directory parsing.Options for output: printing to console, saving to a file, or copying to the clipboard.InstallationpipinstalldtyUsageRun DTY from the command line with the following options:dty<target-directory>[options]If no target directory is specified, DTY will default to the current working directory.Options:-tor--target-file: Target a single file. This option is mutually exclusive with-i,-e, and-r.-ior--include: Patterns to include files. Enclose patterns in quotes to avoid shell expansion (e.g.,'*.py','data*').-eor--exclude: Patterns to exclude files. Enclose patterns in quotes to avoid shell expansion (e.g.,'*.xml','temp*').-oor--output-file: Set the output YAML file name.-ror--recursive: Enable recursive search in directories. Not valid when targeting a single file.-por--print: Print the output using rich formatting.-cor--clipboard: Copy the output to the clipboard.Exampledtymyfolder-i'*.py''*.html'-ooutput.yaml-rThis command will parse all.pyand.htmlfiles inmyfolderrecursively and save the YAML output tooutput.yaml.AuthorsAdrian Galilea -Initial workAcknowledgmentsHat tip to ChatGPT for assistance with project setup and documentation.
Package: dtyp
dtypDeveloper GuideSetup# create conda environment$mambaenvcreate-fenv.yml# update conda environment$mambaenvupdate-ndtyp--fileenv.ymlInstallpipinstall-e.# install from pypipipinstalldtypnbdev# activate conda environment$condaactivatedtyp# make sure the dtyp package is installed in development mode$pipinstall-e.# make changes under nbs/ directory# ...# compile to have changes apply to the dtyp package$nbdev_preparePublishing# publish to pypi$nbdev_pypi# publish to conda$nbdev_conda--build_args'-c conda-forge'$nbdev_conda--mambabuild--build_args'-c conda-forge -c dsm-72'UsageInstallationInstall latest from the GitHubrepository:$pipinstallgit+https://github.com/dsm-72/dtyp.gitor fromconda$condainstall-cdsm-72dtypor frompypi$pipinstalldtypDocumentationDocumentation can be found hosted on GitHubrepositorypages. Additionally you can find
package manager specific guidelines oncondaandpypirespectively.
Package: dtype-decorate
The DType-Decorate module defines two different decorators at the current state. These decorators can be used to
constrain the attributes of the decorated function to specific data types. This can help to keep functions clean
especially when they are written for a specific context. This is usually the case for scientific applications,
where functionality is often more important than clean code.The basic structure of this module was heavily inspired / extended on the basis of:https://stackoverflow.com/questions/15299878/how-to-use-python-decorators-to-check-function-argumentsInstallationYou can either usepipto install the version from PyPI or git to install the probably more recent version from
github.gitclonehttp://github.com/mmaelicke/dtype-decorate.gitcddtype-decoratepipinstall-rrequirements.txtpythonsetup.pyinstallpipinstalldtype-decorateUsageThere are two decorators so far:acceptandenforce.acceptwill restrict the attribute data types to the
the defined ones, whileenforcewill try to convert the given attribute to a desired data type.
Both can also be used together, whereacceptdoes only make sense to be used afterenforce.Define a function that does only accept anintand afloat.importddec@ddec.accept(a=int,b=float)deff(a,b):passYou can also specify more than one data type allowed. Any attribute not given in the decorator will just be
ignored.@ddec.accept(a=(int,float))deff(a,be_any_type)passf(5,'mystr')# will run finef('mystr',5)# will raise a TypeErrorTheacceptdecorator can also handle None type and callables like functions or lambda. These have to be specified
as a string.@ddec.accept(a='None',b=('None','callable'))deff(a,b):passf(None,None)# will run finef(None,lambdax:x)# will run finef(5,None)# will raise a TypeError
Package: dtypes
dtypesYo yo what's this?Well it's ✨dtypes✨ which is extra stuff to makectypesusable. Or as the my future kids like to say,"dtypesis onctypeslike butter is on toast".Who wants to doclassYolo(ctypes.structure):_fields_=[("a",ctypes.c_int),("b",ctypes.c_float),("c",ctypes.c_double),]when you can dofromdtypes.structifyimportstructify@structifyclassYolo(ctypes.structure):a:ctypes.c_intb:ctypes.c_floatc:ctypes.c_doubleAnd then, who wants to deal with the messy and incomplete way of working with forward declarations in pure ctypes?classYeet(ctypes.structure):passclassChonko(ctypes.structure):_fields_=[("yeet",ctypes.POINTER(Yeet)),]Yeet._fields_=[("chonker",Chonko),("this",ctypes.POINTER(Yeet),]when you can dofromdtypes.structifyimportstructifyfromdtypes.fwdimportfwd,ThisPtr,PointerYeet=fwd()@structifyclassChonko(ctypes.structure):yeet:Pointer(Yeet)@structifyclassYeet(ctypes.structure,Yeet):chonker:Chonkothis:ThisPtr]
Package: du2html
du2htmldu2htmlis a tool to generate human-readable html report from du (disk usage in linux and macos) result.Installationfrompypipip install du2htmlfromgithubpip install https://github.com/danielmsk/du2html/raw/main/dist/du2html-0.0.5-py3-none-any.whlDependencyThisdu2htmldoesn't need any other package:Optionsoptional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -i IN, --in IN        input du result file
  -t TOTALSIZE, --totalsize TOTALSIZE
                        total hard disk size (ex: 32t, 100G, 200g)
  -o OUT, --out OUT     output html fileUsageMake HTML reportdu2html -i du_result.txt -t 32t -o du_out.htmlVersion History0.0.5 (2022-04-13)add relative path for js and css in template html0.0.4 (2022-04-13)debug0.0.3 (2022-04-13)debug util.py0.0.2 (2022-04-13)update README.md0.0.1 (2022-04-12)first released.
Package: dual-audio
Dual-audio video makerYou can pass 2 playlists (or 2 lists with playlists), first for extracting audio (audio-playlists), second for resulting video (video-playlists), and get video with both audio tracks. For the first playlists it is better to use low quality video.DependenciesYou need installed in systemffmpeg(work with media),wget(download) andgreputilities.Installpipinstalldual-audioUsage exampleExtract audios from video files fromaudio-playlist.m3uand add to related videos fromvideo-playlist.m3u(for example,1x1.aacwill be added to1x1.mp4).dual-audio--out-dir.-aaudio-playlist.m3u-vvideo-playlist.m3uNumber of entries in both audio and video playlists should be equal.After downloading and converting, you may also want to specify a language for each audio track. Create a file with filenames to do this mapping, e.g.list.txt(or usefinished.txt), then if the first audio track is russian and the second is english, run:dual-audio\--fix-audio-lang\--fix-audio-lang-listlist.txt\--first-audio-langrus\--second-audio-langengFirst track from video playlist, second from audio playlist.CLI argumentsArgumentAction-d, --out-dirDirectory where place audio and video folders-a, --audio-playlistsPath(s) to playlist(s) with videos from which extract audio-v, --video-playlistsPath(s) to playlist(s) with videos to add a second audio--argsPass shell arguments via file--preserve-videoPreserving original videos fromvideo-playlists-h, --helpShow help message and exit--fix-audio-langFix audio tracks language metadata1--fix-audio-lang-listFile with list of filenames to fix language--first-audio-langLanguage in first audio track (from video file)2--second-audio-langLanguage in second audio track (from extracted audio)1If specified, downloading and converting will not be performed.2Language is 3-letter identifier like "eng" or "rus".Shortened M3U playlist syntaxYou can write playlists manually by this template:#EXTM3U
#EXTINF: <duration>,<title>
#EXTVLCOPT:
<link>#EXTM3Uis the required header for the file,duration can be zero,the title must not contain commas,the link should be on a separate line,other lines and directives are ignored and can be omitted.For example:#EXTM3U
#EXTINF: 0,Your show - episode 1
http://example.com/1x1.mp4
#EXTINF: 0,Your show - episode 2
http://example.com/1x2.mp4These videos will be saved asYour show - episode 1.mp4andYour show - episode 2.mp4.How it worksParse playlists.Downloadaudio-playlists. For each playlist:Download videos tovideo-cachefolder,Extract audio toaudiofolder and select extension based onffprobe(fromffmpeg) output,For example, from theStream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 94 kb/sline will be takenaac.For each playlist fromvideo-playlistsdownload videos tovideo/folder.Correlate audio and video file names (for example,1x1.aacwill be added to1x1.mp4).Join audios and videos and save tovideo-resultfolder.If--preserve-videois not passed, move resulting videos tovideofolder.
Package: dualbounds
A python implementation of the dual bounds framework for inference on partially identified estimands (and the solutions to optimization problems more generally). Seehttps://amspector100.github.io/dualbounds/for detailed documentation and tutorials.InstallationTo installdualbounds, just use pip:pip install dualboundsDocumentationDocumentation and tutorials are available athttps://amspector100.github.io/dualbounds/.QuickstartGiven a response vectory, binary treatment vectorW, covariate matrixX, and an (optional) propensity score vectorpis, dualbounds allows analysts to perform inference on partially identified estimands of the form E[f(Y(0), Y(1), X)], for any choice of f. For example, the code below shows how to perform inference in P(Y(0) < Y(1)), the proportion of individuals who benefit from the treatment. Dual bounds can wrap on top ofanymachine learning model to provide provably valid confidence intervals in randomized experiments.import dualbounds as db
	# Generate synthetic data from a heavy-tailed linear model
	data = db.gen_data.gen_regression_data(
		n=900, # Num. datapoints
		p=30, # Num. covariates
		r2=0.95, # population R^2
		tau=3, # average treatment effect
		interactions=True, # ensures treatment effect is heterogenous
		eps_dist='laplace', # heavy-tailed residuals
		sample_seed=123, # random seed
	)

	# Initialize dual bounds object
	dbnd = db.generic.DualBounds(
		f=lambda y0, y1, x: y0 < y1, # defines the estimand
		X=data['X'], # n x p covariate matrix
		W=data['W'], # n-length treatment vector
		y=data['y'], # n-length outcome vector
		pis=data['pis'], # n-length propensity scores (optional)
		Y_model='ridge', # description of model for Y | X, W
	)

	# Perform inference
	dbnd.compute_dual_bounds(
		nfolds=5, # number of cross-fitting folds
		alpha=0.05 # nominal level
	)ReferenceIf you usedualboundsin an academic publication, please consider citingJi, Lei, and Spector (2023). The bibtex is below:@misc{ji2023modelagnostic,
      title={Model-Agnostic Covariate-Assisted Inference on Partially Identified Causal Effects}, 
      author={Wenlong Ji and Lihua Lei and Asher Spector},
      year={2023},
      eprint={2310.08115},
      archivePrefix={arXiv},
      primaryClass={econ.EM}
}
Package: dualdesc
dualdescDual description for polytopes. A wrapper aroundpyparma, which itself wrapsppl.
Mainly for easily converting between H- and V-representations. No utilities for facet enumeration, adjacencies, etc.UsageConstructorsThis package contains one class,Polytope. Main constructors are:Polytope.FromHalfspaces(A, b)represents the polytope defined by all pointsxs.t.A @ x <= b.
If there arenhalfspaces and the ambient dimension isd, the shapes of these matrices are:A:(nu, d)b:(d,)Polytope.FromGenerators(V, R)represents the polytope defined byconv(V) + nonneg(R),
whereconvis the convex combination of a set of points andnonnegis non-negative linear combinations
of a set of points, and+is Minkowski addition.There are alsoPolytope.Empty(dim: int)andPolytope.Universe(dim: int)constructors.All constructors also take ascale > 0(default1e5) parameter to control quantization, since ppl uses rational arithmetic.
Quantization is done asq = round(scale * x)going into ppl, andx = q / scalecoming out.ConversionThere are methodsA, b = poly.get_inequalities()andV, R = poly.get_generators()which return the respective representations.Note that PPL is lazy, and converting between representations can take a long time, so calling these methods might be slow.Incremental constructionIncremental construction is supported via methodsadd_halfspace(A, b),add_point(V), andadd_ray(R).
All are "vectorized", i.e. they support adding a single halfspace/point/ray, or multiple.Since these mutate, you can also copy polytopes:poly.copy().A simple exampleThe example below defines an unbounded (i.e. non-null cone part) polytope with 3 facets and 2 vertices:importnumpyasnpimportdualdescasddM=np.array([[1,0,1],# x0        <= 1[0,2,1],#      2 x1 <= 1[1,1,1],# x0 +   x1 <= 1],dtype=np.float64)A=M[:,:2]b=M[:,-1]poly=dd.Polytope.FromHalfspaces(A,b)V,R=poly.to_generators()# Vertices:# 	V = [[0.5, 0.5], [1, 0]]# Cone:# 	R = [[-1, 0], [0, -1]]Why ...?Why not pypoman?pypomanhas more features, but only supports bounded polytopes.Why not use pyparma directly?It doesn't have a nice interface.Why not use pycddlib?pycddlibhas more features (like adjacency lists), but is too low level and doesn't have a nice interface.Why not wrap pplpy instead?I might do this at some point, since there are issues buildingpyparmawith Cython 3.
Package: dualite-transnumerique
La dualité transnumériqueImplémentation de l'algorithme décrit danshttp://n-interaction.chSource aléatoireLe fichier de 300k entrées a été créé en utilisant cette source:https://www.random.org/InstallationWindowsInstaller python 3.6:https://www.python.org/ftp/python/3.6.6/python-3.6.6-amd64-webinstall.execocher "ajouter python au PATH"Depuis un terminal (touche windows+x, "executer", "cmd"):pip install --upgrade dualite-transnumeriqueVisiter c:\Users{monUser}\AppData\Local\Programs\Python\Python36\ScriptsRight click sur "dualite_transnumerique" -> "Envoyer sur" -> "bureau"
Package: duallog
The duallog packagePython package to enable simultaneous logging to console and logfile.Duallog screenshotHow to install duallog?You can install duallog usingpip, or you can install from source.
Below you find instructions for both ways.Installation via pipIn the terminal, runpip install duallog.Installation from sourceDownload and unpack this repository.Open a terminal and navigate to the repository.Executepython setup.py installfrom within the repository.How to use duallog?Using duallog is very simple, as illustrated in the following minimal example script.# Import the duallog package to set up simultaneous logging to screen and console.importduallog# Import the logging package to generate log messages.importlogging# Set up dual logging and tell duallog where to store the logfiles.duallog.setup('logtest')# Generate some log messages.logging.debug('Debug messages are only sent to the logfile.')logging.info('Info messages are not shown on the console, too.')logging.warning('Warnings appear both on the console and in the logfile.')logging.error('Errors get the same treatment.')logging.critical('And critical messages, of course.')The output of this program is shown in the screenshot at the top of this page.
Package: dualmesh
DualMeshPython module for generating dual meshes.Requirementsmeshio >= 4.0numpy >= 1.16.3InstallationEither install using pippip install dualmeshor copy the file dualmesh.py from the dualmesh directory in this repository.ExampleWe can go through the example of using dual_mesh.py module.First, we import all the needed modules# For opening a mesh file
import meshio
# For generating a dual mesh
import dualmesh as dm
# For plotting both the mesh and dual mesh
import matplotlib.pyplot as pltWe load the mesh for which we want a dual meshmsh = meshio.read("example.msh")We get the dual mesh object using dual_mesh.pydual_msh = dm.get_dual(msh, order=True)We use matplotlib to plot the original meshfig, ax = plt.subplots()
ax.triplot(msh.points[:, 0], msh.points[:, 1], msh.cells["triangle"])We loop over the polygons (cells) in the dual mesh and we plot themfor cell in dual_msh.cells["polygon"]:
    # We get the coordinates of the current polygon.
    # We repeat one of the points, so that when plotted, we get a complete polygon
    cell_points = dual_msh.points[cell + [cell[0]]]

    # We plot the points of the current polygon
    ax.plot(cell_points[:, 0], cell_points[:, 1], ":", color="black")And finally we add the legend and save the resulting figure# We add a legend to the figure
fig.legend([ax.lines[0], ax.lines[-1]], ["Mesh", "Dual mesh"])
# We save the resulting figure
fig.savefig("example.png")
Package: dualnum
dualnumPython bindings for thenum-dualrust crate.Installationpip install dualnumInstallation from sourceTo install from source, you need to have the rust compiler installed.pip install git+https://github.com/itt-ustutt/dualnumSphinx documentationTo build the documentation with sphinx:maturin develop --release
cd docs
make html
make doctest
firefox _build/html/index.htmlUsageCompute first and second derivative of a scalar valued function.fromdualnumimportderive2importnumpyasnpdeff(x):returnnp.exp(x)/np.sqrt(np.sin(x)**3+np.cos(x)**3)x=derive2(1.5)result=f(x)print('f(x)    ={}'.format(result.value))print('df/dx   ={}'.format(result.first_derivative))print('d2f/dx2 ={}'.format(result.second_derivative))
Package: dual-pairs
dual_pairsA SageMath package for computing with dual pairs of algebras.AuthorPeter Bruin,P.J.Bruin@math.leidenuniv.nlPrerequisitesSageMath,http://www.sagemath.org/.  This package has been tested
with SageMath versions from 8.2 up to 9.7; it may also work with
older or newer versions.Installation$ sage --pip install dual_pairsDocumentationThe documentation for this package is automatically generated from the
source code and is available athttps://dual-pairs.readthedocs.io/en/latest/.TODOBetter documentationMore functionality for torsors