Example #1
0
#!/usr/bin/env python3.8
"""
    register-books.py --- Update books registry if necessary
    Author: Tigran Aivazian <*****@*****.**>
"""

import os, sys, re
from subprocess import Popen, PIPE
from argparse import ArgumentParser as argp

p = argp(description="Register Books in URANTIA Library")
p.add_argument("-d",
               action="store",
               help="Top-level books directory",
               dest="rootdir",
               required=True)
p.add_argument("-v",
               action="store_true",
               help="Print verbose (non-critical) messages",
               dest="verbose")
p.add_argument("-n",
               action="store_true",
               help="Dry run, don't modify anything",
               dest="dryrun")
p.add_argument("-f",
               action="store_true",
               help="Force rebuilding existing covers",
               dest="force")
args = p.parse_args()

descr = "register-books"
Example #2
0
import matplotlib as mplt
import matplotlib.pyplot as plt
from matplotlib import cm
from numpy import load, linspace, mgrid, memmap, append, unique
from argparse import ArgumentParser as argp

from time import time
t_start = time()

# our own modules
from midnorm import MidpointNormalize
norm = MidpointNormalize(midpoint=0.0)

mplt.rc('font', family='serif', size=9)

p = argp(description="Quantum Infodynamics Tools - Solution Animator")
p.add_argument("-s",
               action="append",
               help="Solution data filename (multiple OK)",
               dest="sfilenames",
               required=True,
               default=[])
p.add_argument("-W",
               action="store_true",
               help="Animate W(x,p,t) only",
               dest="Wonly")
p.add_argument(
    "-c",
    action="store",
    help="Number of contour levels of W(x,p,t) to plot (default 100)",
    dest="clevels",
Example #3
0
#!/usr/bin/env python3.8
"""
   initgauss.py --- Quantum Infodynamics Tools (Cauchy Data Generator)
   Author: Tigran Aivazian <*****@*****.**>
   License: GPL
"""

from argparse import ArgumentParser as argp
from numpy import array, zeros, mgrid, pi, exp, memmap, savez

p = argp(
    description="Quantum Infodynamics Tools - Gaussian Cauchy Data Generator")
p.add_argument("-x0",
               action="append",
               help="Initial packet's x-coordinate (multiple OK)",
               dest="x0",
               type=float,
               required=True,
               default=[])
p.add_argument("-p0",
               action="append",
               help="Initial packet's p-coordinate (multiple OK)",
               dest="p0",
               type=float,
               required=True,
               default=[])
p.add_argument("-sigmax",
               action="append",
               help="Initial packet's sigmax (multiple OK)",
               dest="sigmax",
               type=float,
#!/usr/bin/env python3.8

"""
  solplay.py --- Quantum Infodynamics Tools - Solution Playback
  Author: Tigran Aivazian <*****@*****.**>
  License: GPL
"""
import matplotlib as mplt
from numpy import load, linspace, mgrid, memmap, append, unique, sqrt
from argparse import ArgumentParser as argp
from time import time

p = argp(description="Quantum Infodynamics Tools - Solution Playback")
p.add_argument("-s", action="append", help="Solution data filename (multiple OK)", dest="sfilenames", required=True, default=[])
p.add_argument("-o", action="store", help="Output animation to the file", dest="ofilename")
p.add_argument("-r", action="store", help="Number of frames per second [25]", dest="fps", type=int, default=25)
p.add_argument("-np",  action="store_true", help="Do not plot momentum distribution", dest="nophi")
p.add_argument("-W",  action="store_true", help="Animate W(x,p,t) only", dest="Wonly")
p.add_argument("-l",  action="store_true", help="Pre-load solution data before animation", dest="preload")
p.add_argument("-c", action="store", help="Number of contour levels of W(x,p,t) to plot [100]", dest="clevels", type=int, default=100)
p.add_argument("-fw", action="store", help="Frame width in pixels [1920]", dest="framew", type=int, default=1920)
p.add_argument("-fh", action="store", help="Frame height in pixels [1080]", dest="frameh", type=int, default=1080)
args = p.parse_args()

Wonly, fps, ofilename, preload, nophi = args.Wonly, args.fps, args.ofilename, args.preload, args.nophi
if ofilename: preload = True
assert fps > 0

import matplotlib.pyplot as plt
from matplotlib import cm, animation
Example #5
0
#!/usr/bin/env python3

import subprocess as sp
from subprocess import Popen as pp
from argparse import ArgumentParser as argp
from sys import argv
from os import getpid
import getpass, time, os
import psutil

#setting arguments
parser = argp()

parser.add_argument("-i",
                    "--interface",
                    dest="interface",
                    help="your wifi interface ex: 'wlan0'")
parser.add_argument("-s",
                    "--ssid",
                    dest="ssid",
                    help="SSID / the name of your acess point")
parser.add_argument("-p", "--password", dest="password", help="wifi password")
parser.add_argument("-l",
                    "--list",
                    dest="list",
                    help="prints current active SSID",
                    action="store_true")
parser.add_argument("-v",
                    "--verbose",
                    dest="verbose",
                    help="increase output verbosity",
Example #6
0
    def store(self):
        self.storage.store()

    def remove(self):
        self.storage.truncate()

    def count(self):
        return self.storage.count()

    def query(self, key):
        data = self.storage.query(key)
        return data


if __name__ == "__main__":
    parser = argp(description="test code for waldo photos")
    parser.add_argument("-action",  "--action",  help="action needed", required=True, choices=["store", "remove", "count", "query"])
    parser.add_argument("-extract", "--extract", help="true if exif data to be extracted out of images", required=False)
    parser.add_argument("-key",     "--key",     help="image key to be queried", required=False)
    parser.add_argument("-lastmodified",     "--lastmodified",     help="image's lastmodified date to be queried", required=False)
    parser.add_argument("-etag",     "--etag",     help="image's etag to be queried", required=False)

    args = parser.parse_args()
    action = args.action
    extract_image_exif = args.extract

    if action == "query":
        data = main(extract_image_exif).query(args)
        for each in data:
            pprint(each)
    elif action == "store":
Example #7
0
from timeit import default_timer as timer
import sys


def str2bool(v):
    if isinstance(v, bool):
        return v
    if v.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    elif v.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    else:
        raise argparse.ArgumentTypeError('Boolean value expected.')


p = argp(description="Quantum Infodynamics Tools - Equations Solver")
p.add_argument("-d",
               action="store",
               help="Description text",
               dest="descr",
               required=True)
p.add_argument("-t1",
               action="store",
               help="Starting time",
               dest="t1",
               type=float,
               required=True)
p.add_argument("-t2",
               action="store",
               help="Final time",
               dest="t2",
Example #8
0
def parse_args():
    ap = argp(description="input file with master.json")
    ap.add_argument("-i", "--input")
    args = ap.parse_args()
    return args.input