• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(319401)  |  Call(317453)  |  Derive(1945)  |  Import(3)
str(object) -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/raytracer/do_raytrace.py   quickflash(Download)
def parse_cli() :
 
    from optparse import OptionParser
 
    usage = str("%prog input_file [options]")
    version = str("%prog 0.1")
 
    argParser = OptionParser(usage, version=version)
 
    # sample_spacing
 
    sample_spacing_str = str("sample_spacing")
 
    # detector x-coordinate
 
    detector_x_str = str("detector_x")
 
    argParser.add_option("--" + detector_x_str, type="float",
                         dest="detector_x",
                         help="Detector axis x-coordinate (cm)")
 
    argParser.set_defaults(detector_x=detector_x_default)
 
    # detector azimuth
 
    detector_azimuth_str = str("detector_azimuth")
 
    # Film pixels along cylinder axis
 
    film_pixels_x_str = str("film_pixels_x")
 
    argParser.add_option("--" + film_pixels_x_str, type="int",
                         dest="film_pixels_x",
                         help="Film pixels along cylinder axis")
 
    argParser.set_defaults(film_pixels_x=film_pixels_x_default)
 
    # Film pixels along transvers axis
 
    film_pixels_y_str = str("film_pixels_y")
 
    # Rays per pixel
 
    rays_per_pixel_str = str("rays_per_pixel")
 
    argParser.add_option("--" + rays_per_pixel_str, type="int",
                         dest="rays_per_pixel",
                         help="Number of rays per pixel")
 
    argParser.set_defaults(rays_per_pixel=rays_per_pixel_default)
 
    # Rays per pixel
 
    mpi_processes_str = str("mpi_processes")
 
    argPtr = int(0)
 
    input_file = str(args[argPtr])
    argPtr += 1
 
    # Parse options
 
    parmstr.append("Input file [ " + input_file + " ]")
 
    parmstr.append("Cylinder axis y-coord [ " + str(cylinder_y) + " cm ]")
    parmstr.append("Cylinder axis z-coord [ " + str(cylinder_z) + " cm ]")
 
    parmstr.append("Cylinder max radius [ " + str(cylinder_max_radius)
                   + " cm ]")
 
    parmstr.append("Cylinder min x-coord [ " + str(cylinder_min_x) + " cm ]");
    parmstr.append("Cylinder max x-coord [ " + str(cylinder_max_x) + " cm ]");
 
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
                   + " cm ]")
 
    parmstr.append("Detector axis x-coord [ " + str(detector_x) + " cm ]")
    parmstr.append("Detector axis azimuthal angle [ "
                   + str(detector_azimuth_deg) + " deg ]")
 
    parmstr.append("Source distance [ " + str(source_distance) + " cm ]")
    parmstr.append("Source diameter [ " + str(source_diameter) + " cm ]")
 
    parmstr.append("Film distance [ " + str(film_distance) + " cm ]")
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
                   + " cm ]")
    parmstr.append("Film size along transverse axis [ " + str(film_size_y)
                   + " cm ]")
 
    parmstr.append("Film pixels along cyilnder axis [ " + str(film_pixels_x)
                   + " ] - " + str(1.0e+4 * film_size_x / float(film_pixels_x))
                   + " microns / pixel")
    parmstr.append("Film pixels along transverse axis [ " + str(film_pixels_y)
                   + " ] - " + str(1.0e+4 * film_size_y / float(film_pixels_x))
                   + " microns / pixel")
 
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
 
    if (use_mpi) :
        parmstr.append("MPI processes [ " + str(mpi_processes) + " ]")
        parmstr.append("MPI exec [ " + str(mpirun_exec) + " ]")
 
    # Log the parameters
    full_exec = None
 
    if (use_mpi) :
        full_exec = mpirun_exec + " -np " + str(mpi_processes) + " " \
                    + executable
    else :
        full_exec = executable
 
    exec_str = full_exec + " " + input_file + " " + str(cylinder_y) + " " \
               + str(cylinder_z) + " " + str(cylinder_max_radius) + " " \
               + str(cylinder_min_x) + " " + str(cylinder_max_x) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(film_distance) + " " \
               + str(film_size_x) + " " + str(film_size_y) + " " \
               + str(film_pixels_x) + " " + str(film_pixels_y) + " " \
               + str(rays_per_pixel)

src/q/u/quickflash-HEAD/trunk/examples/raytracer/do_raytrace.py   quickflash(Download)
def parse_cli() :
 
    from optparse import OptionParser
 
    usage = str("%prog input_file [options]")
    version = str("%prog 0.1")
 
    argParser = OptionParser(usage, version=version)
 
    # sample_spacing
 
    sample_spacing_str = str("sample_spacing")
 
    # detector x-coordinate
 
    detector_x_str = str("detector_x")
 
    argParser.add_option("--" + detector_x_str, type="float",
                         dest="detector_x",
                         help="Detector axis x-coordinate (cm)")
 
    argParser.set_defaults(detector_x=detector_x_default)
 
    # detector azimuth
 
    detector_azimuth_str = str("detector_azimuth")
 
    # Film pixels along cylinder axis
 
    film_pixels_x_str = str("film_pixels_x")
 
    argParser.add_option("--" + film_pixels_x_str, type="int",
                         dest="film_pixels_x",
                         help="Film pixels along cylinder axis")
 
    argParser.set_defaults(film_pixels_x=film_pixels_x_default)
 
    # Film pixels along transvers axis
 
    film_pixels_y_str = str("film_pixels_y")
 
    # Rays per pixel
 
    rays_per_pixel_str = str("rays_per_pixel")
 
    argParser.add_option("--" + rays_per_pixel_str, type="int",
                         dest="rays_per_pixel",
                         help="Number of rays per pixel")
 
    argParser.set_defaults(rays_per_pixel=rays_per_pixel_default)
 
    # Rays per pixel
 
    mpi_processes_str = str("mpi_processes")
 
    argPtr = int(0)
 
    input_file = str(args[argPtr])
    argPtr += 1
 
    # Parse options
 
    parmstr.append("Input file [ " + input_file + " ]")
 
    parmstr.append("Cylinder axis y-coord [ " + str(cylinder_y) + " cm ]")
    parmstr.append("Cylinder axis z-coord [ " + str(cylinder_z) + " cm ]")
 
    parmstr.append("Cylinder max radius [ " + str(cylinder_max_radius)
                   + " cm ]")
 
    parmstr.append("Cylinder min x-coord [ " + str(cylinder_min_x) + " cm ]");
    parmstr.append("Cylinder max x-coord [ " + str(cylinder_max_x) + " cm ]");
 
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
                   + " cm ]")
 
    parmstr.append("Detector axis x-coord [ " + str(detector_x) + " cm ]")
    parmstr.append("Detector axis azimuthal angle [ "
                   + str(detector_azimuth_deg) + " deg ]")
 
    parmstr.append("Source distance [ " + str(source_distance) + " cm ]")
    parmstr.append("Source diameter [ " + str(source_diameter) + " cm ]")
 
    parmstr.append("Film distance [ " + str(film_distance) + " cm ]")
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
                   + " cm ]")
    parmstr.append("Film size along transverse axis [ " + str(film_size_y)
                   + " cm ]")
 
    parmstr.append("Film pixels along cyilnder axis [ " + str(film_pixels_x)
                   + " ] - " + str(1.0e+4 * film_size_x / float(film_pixels_x))
                   + " microns / pixel")
    parmstr.append("Film pixels along transverse axis [ " + str(film_pixels_y)
                   + " ] - " + str(1.0e+4 * film_size_y / float(film_pixels_x))
                   + " microns / pixel")
 
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
 
    if (use_mpi) :
        parmstr.append("MPI processes [ " + str(mpi_processes) + " ]")
        parmstr.append("MPI exec [ " + str(mpirun_exec) + " ]")
 
    # Log the parameters
    full_exec = None
 
    if (use_mpi) :
        full_exec = mpirun_exec + " -np " + str(mpi_processes) + " " \
                    + executable
    else :
        full_exec = executable
 
    exec_str = full_exec + " " + input_file + " " + str(cylinder_y) + " " \
               + str(cylinder_z) + " " + str(cylinder_max_radius) + " " \
               + str(cylinder_min_x) + " " + str(cylinder_max_x) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(film_distance) + " " \
               + str(film_size_x) + " " + str(film_size_y) + " " \
               + str(film_pixels_x) + " " + str(film_pixels_y) + " " \
               + str(rays_per_pixel)

src/q/u/quickflash-HEAD/rtflame/examples/raytracer/do_raytrace.py   quickflash(Download)
def parse_cli() :
 
    from optparse import OptionParser
 
    usage = str("%prog input_file [options]")
    version = str("%prog 0.1")
 
    argParser = OptionParser(usage, version=version)
 
    # sample_spacing
 
    sample_spacing_str = str("sample_spacing")
 
    # detector x-coordinate
 
    detector_x_str = str("detector_x")
 
    argParser.add_option("--" + detector_x_str, type="float",
                         dest="detector_x",
                         help="Detector axis x-coordinate (cm)")
 
    argParser.set_defaults(detector_x=detector_x_default)
 
    # detector azimuth
 
    detector_azimuth_str = str("detector_azimuth")
 
    # Film pixels along cylinder axis
 
    film_pixels_x_str = str("film_pixels_x")
 
    argParser.add_option("--" + film_pixels_x_str, type="int",
                         dest="film_pixels_x",
                         help="Film pixels along cylinder axis")
 
    argParser.set_defaults(film_pixels_x=film_pixels_x_default)
 
    # Film pixels along transvers axis
 
    film_pixels_y_str = str("film_pixels_y")
 
    # Rays per pixel
 
    rays_per_pixel_str = str("rays_per_pixel")
 
    argParser.add_option("--" + rays_per_pixel_str, type="int",
                         dest="rays_per_pixel",
                         help="Number of rays per pixel")
 
    argParser.set_defaults(rays_per_pixel=rays_per_pixel_default)
 
    # Rays per pixel
 
    mpi_processes_str = str("mpi_processes")
 
    argPtr = int(0)
 
    input_file = str(args[argPtr])
    argPtr += 1
 
    # Parse options
 
    parmstr.append("Input file [ " + input_file + " ]")
 
    parmstr.append("Cylinder axis y-coord [ " + str(cylinder_y) + " cm ]")
    parmstr.append("Cylinder axis z-coord [ " + str(cylinder_z) + " cm ]")
 
    parmstr.append("Cylinder max radius [ " + str(cylinder_max_radius)
                   + " cm ]")
 
    parmstr.append("Cylinder min x-coord [ " + str(cylinder_min_x) + " cm ]");
    parmstr.append("Cylinder max x-coord [ " + str(cylinder_max_x) + " cm ]");
 
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
                   + " cm ]")
 
    parmstr.append("Detector axis x-coord [ " + str(detector_x) + " cm ]")
    parmstr.append("Detector axis azimuthal angle [ "
                   + str(detector_azimuth_deg) + " deg ]")
 
    parmstr.append("Source distance [ " + str(source_distance) + " cm ]")
    parmstr.append("Source diameter [ " + str(source_diameter) + " cm ]")
 
    parmstr.append("Film distance [ " + str(film_distance) + " cm ]")
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
                   + " cm ]")
    parmstr.append("Film size along transverse axis [ " + str(film_size_y)
                   + " cm ]")
 
    parmstr.append("Film pixels along cyilnder axis [ " + str(film_pixels_x)
                   + " ] - " + str(1.0e+4 * film_size_x / float(film_pixels_x))
                   + " microns / pixel")
    parmstr.append("Film pixels along transverse axis [ " + str(film_pixels_y)
                   + " ] - " + str(1.0e+4 * film_size_y / float(film_pixels_x))
                   + " microns / pixel")
 
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
 
    if (use_mpi) :
        parmstr.append("MPI processes [ " + str(mpi_processes) + " ]")
        parmstr.append("MPI exec [ " + str(mpirun_exec) + " ]")
 
    # Log the parameters
    full_exec = None
 
    if (use_mpi) :
        full_exec = mpirun_exec + " -np " + str(mpi_processes) + " " \
                    + executable
    else :
        full_exec = executable
 
    exec_str = full_exec + " " + input_file + " " + str(cylinder_y) + " " \
               + str(cylinder_z) + " " + str(cylinder_max_radius) + " " \
               + str(cylinder_min_x) + " " + str(cylinder_max_x) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(film_distance) + " " \
               + str(film_size_x) + " " + str(film_size_y) + " " \
               + str(film_pixels_x) + " " + str(film_pixels_y) + " " \
               + str(rays_per_pixel)

src/q/u/quickflash-HEAD/netcdf/examples/raytracer/do_raytrace.py   quickflash(Download)
def parse_cli() :
 
    from optparse import OptionParser
 
    usage = str("%prog input_file [options]")
    version = str("%prog 0.1")
 
    argParser = OptionParser(usage, version=version)
 
    # sample_spacing
 
    sample_spacing_str = str("sample_spacing")
 
    # detector x-coordinate
 
    detector_x_str = str("detector_x")
 
    argParser.add_option("--" + detector_x_str, type="float",
                         dest="detector_x",
                         help="Detector axis x-coordinate (cm)")
 
    argParser.set_defaults(detector_x=detector_x_default)
 
    # detector azimuth
 
    detector_azimuth_str = str("detector_azimuth")
 
    # Film pixels along cylinder axis
 
    film_pixels_x_str = str("film_pixels_x")
 
    argParser.add_option("--" + film_pixels_x_str, type="int",
                         dest="film_pixels_x",
                         help="Film pixels along cylinder axis")
 
    argParser.set_defaults(film_pixels_x=film_pixels_x_default)
 
    # Film pixels along transvers axis
 
    film_pixels_y_str = str("film_pixels_y")
 
    # Rays per pixel
 
    rays_per_pixel_str = str("rays_per_pixel")
 
    argParser.add_option("--" + rays_per_pixel_str, type="int",
                         dest="rays_per_pixel",
                         help="Number of rays per pixel")
 
    argParser.set_defaults(rays_per_pixel=rays_per_pixel_default)
 
    # Rays per pixel
 
    mpi_processes_str = str("mpi_processes")
 
    argPtr = int(0)
 
    input_file = str(args[argPtr])
    argPtr += 1
 
    # Parse options
 
    parmstr.append("Input file [ " + input_file + " ]")
 
    parmstr.append("Cylinder axis y-coord [ " + str(cylinder_y) + " cm ]")
    parmstr.append("Cylinder axis z-coord [ " + str(cylinder_z) + " cm ]")
 
    parmstr.append("Cylinder max radius [ " + str(cylinder_max_radius)
                   + " cm ]")
 
    parmstr.append("Cylinder min x-coord [ " + str(cylinder_min_x) + " cm ]");
    parmstr.append("Cylinder max x-coord [ " + str(cylinder_max_x) + " cm ]");
 
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
                   + " cm ]")
 
    parmstr.append("Detector axis x-coord [ " + str(detector_x) + " cm ]")
    parmstr.append("Detector axis azimuthal angle [ "
                   + str(detector_azimuth_deg) + " deg ]")
 
    parmstr.append("Source distance [ " + str(source_distance) + " cm ]")
    parmstr.append("Source diameter [ " + str(source_diameter) + " cm ]")
 
    parmstr.append("Film distance [ " + str(film_distance) + " cm ]")
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
                   + " cm ]")
    parmstr.append("Film size along transverse axis [ " + str(film_size_y)
                   + " cm ]")
 
    parmstr.append("Film pixels along cyilnder axis [ " + str(film_pixels_x)
                   + " ] - " + str(1.0e+4 * film_size_x / float(film_pixels_x))
                   + " microns / pixel")
    parmstr.append("Film pixels along transverse axis [ " + str(film_pixels_y)
                   + " ] - " + str(1.0e+4 * film_size_y / float(film_pixels_x))
                   + " microns / pixel")
 
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
 
    if (use_mpi) :
        parmstr.append("MPI processes [ " + str(mpi_processes) + " ]")
        parmstr.append("MPI exec [ " + str(mpirun_exec) + " ]")
 
    # Log the parameters
    full_exec = None
 
    if (use_mpi) :
        full_exec = mpirun_exec + " -np " + str(mpi_processes) + " " \
                    + executable
    else :
        full_exec = executable
 
    exec_str = full_exec + " " + input_file + " " + str(cylinder_y) + " " \
               + str(cylinder_z) + " " + str(cylinder_max_radius) + " " \
               + str(cylinder_min_x) + " " + str(cylinder_max_x) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(film_distance) + " " \
               + str(film_size_x) + " " + str(film_size_y) + " " \
               + str(film_pixels_x) + " " + str(film_pixels_y) + " " \
               + str(rays_per_pixel)

src/q/u/quickflash-HEAD/examples/raytracer/do_raytrace.py   quickflash(Download)
def parse_cli() :
 
    from optparse import OptionParser
 
    usage = str("%prog input_file [options]")
    version = str("%prog 0.1")
 
    argParser = OptionParser(usage, version=version)
 
    # sample_spacing
 
    sample_spacing_str = str("sample_spacing")
 
    # detector x-coordinate
 
    detector_x_str = str("detector_x")
 
    argParser.add_option("--" + detector_x_str, type="float",
                         dest="detector_x",
                         help="Detector axis x-coordinate (cm)")
 
    argParser.set_defaults(detector_x=detector_x_default)
 
    # detector azimuth
 
    detector_azimuth_str = str("detector_azimuth")
 
    # Film pixels along cylinder axis
 
    film_pixels_x_str = str("film_pixels_x")
 
    argParser.add_option("--" + film_pixels_x_str, type="int",
                         dest="film_pixels_x",
                         help="Film pixels along cylinder axis")
 
    argParser.set_defaults(film_pixels_x=film_pixels_x_default)
 
    # Film pixels along transvers axis
 
    film_pixels_y_str = str("film_pixels_y")
 
    # Rays per pixel
 
    rays_per_pixel_str = str("rays_per_pixel")
 
    argParser.add_option("--" + rays_per_pixel_str, type="int",
                         dest="rays_per_pixel",
                         help="Number of rays per pixel")
 
    argParser.set_defaults(rays_per_pixel=rays_per_pixel_default)
 
    # Rays per pixel
 
    mpi_processes_str = str("mpi_processes")
 
    argPtr = int(0)
 
    input_file = str(args[argPtr])
    argPtr += 1
 
    # Parse options
 
    parmstr.append("Input file [ " + input_file + " ]")
 
    parmstr.append("Cylinder axis y-coord [ " + str(cylinder_y) + " cm ]")
    parmstr.append("Cylinder axis z-coord [ " + str(cylinder_z) + " cm ]")
 
    parmstr.append("Cylinder max radius [ " + str(cylinder_max_radius)
                   + " cm ]")
 
    parmstr.append("Cylinder min x-coord [ " + str(cylinder_min_x) + " cm ]");
    parmstr.append("Cylinder max x-coord [ " + str(cylinder_max_x) + " cm ]");
 
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
    parmstr.append("Sample spacing along ray [ " + str(sample_spacing)
                   + " cm ]")
 
    parmstr.append("Detector axis x-coord [ " + str(detector_x) + " cm ]")
    parmstr.append("Detector axis azimuthal angle [ "
                   + str(detector_azimuth_deg) + " deg ]")
 
    parmstr.append("Source distance [ " + str(source_distance) + " cm ]")
    parmstr.append("Source diameter [ " + str(source_diameter) + " cm ]")
 
    parmstr.append("Film distance [ " + str(film_distance) + " cm ]")
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
 
    parmstr.append("Film size along cylinder axis [ " + str(film_size_x)
                   + " cm ]")
    parmstr.append("Film size along transverse axis [ " + str(film_size_y)
                   + " cm ]")
 
    parmstr.append("Film pixels along cyilnder axis [ " + str(film_pixels_x)
                   + " ] - " + str(1.0e+4 * film_size_x / float(film_pixels_x))
                   + " microns / pixel")
    parmstr.append("Film pixels along transverse axis [ " + str(film_pixels_y)
                   + " ] - " + str(1.0e+4 * film_size_y / float(film_pixels_x))
                   + " microns / pixel")
 
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
    parmstr.append("Rays per pixel [ " + str(rays_per_pixel) + " ]")
 
    if (use_mpi) :
        parmstr.append("MPI processes [ " + str(mpi_processes) + " ]")
        parmstr.append("MPI exec [ " + str(mpirun_exec) + " ]")
 
    # Log the parameters
    full_exec = None
 
    if (use_mpi) :
        full_exec = mpirun_exec + " -np " + str(mpi_processes) + " " \
                    + executable
    else :
        full_exec = executable
 
    exec_str = full_exec + " " + input_file + " " + str(cylinder_y) + " " \
               + str(cylinder_z) + " " + str(cylinder_max_radius) + " " \
               + str(cylinder_min_x) + " " + str(cylinder_max_x) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(sample_spacing) + " " \
               + str(detector_x) + " " + str(detector_azimuth) + " " \
               + str(source_distance) + " " + str(source_radius) + " " \
               + str(film_distance) + " " \
               + str(film_size_x) + " " + str(film_size_y) + " " \
               + str(film_pixels_x) + " " + str(film_pixels_y) + " " \
               + str(rays_per_pixel)

src/b/a/badger-lib-HEAD/packages/oauth/oauth/example/client.py   badger-lib(Download)
    def access_resource(self, oauth_request):
        # via post body
        # -> some protected resources
        headers = {'Content-Type' :'application/x-www-form-urlencoded'}
        self.connection.request('POST', RESOURCE_URL, body=oauth_request.to_postdata(), headers=headers)
        response = self.connection.getresponse()
        return response.read()
 
def run_example():
 
    # setup
    print '** OAuth Python Library Example **'
    client = SimpleOAuthClient(SERVER, PORT, REQUEST_TOKEN_URL, ACCESS_TOKEN_URL, AUTHORIZATION_URL)
    consumer = oauth.OAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET)
    # get request token
    print '* Obtain a request token ...'
    pause()
    oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer, callback=CALLBACK_URL, http_url=client.request_token_url)
    oauth_request.sign_request(signature_method_plaintext, consumer, None)
    print 'REQUEST (via headers)'
    print 'parameters: %s' % str(oauth_request.parameters)
    pause()
    token = client.fetch_request_token(oauth_request)
    print 'GOT'
    print 'key: %s' % str(token.key)
    print 'secret: %s' % str(token.secret)
    print 'callback confirmed? %s' % str(token.callback_confirmed)
    pause()
    oauth_request = oauth.OAuthRequest.from_token_and_callback(token=token, http_url=client.authorization_url)
    print 'REQUEST (via url query string)'
    print 'parameters: %s' % str(oauth_request.parameters)
    pause()
    # this will actually occur only on some callback
    response = client.authorize_token(oauth_request)
    oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer, token=token, verifier=verifier, http_url=client.access_token_url)
    oauth_request.sign_request(signature_method_plaintext, consumer, token)
    print 'REQUEST (via headers)'
    print 'parameters: %s' % str(oauth_request.parameters)
    pause()
    token = client.fetch_access_token(oauth_request)
    print 'GOT'
    print 'key: %s' % str(token.key)
    print 'secret: %s' % str(token.secret)
    print '* Access protected resources ...'
    pause()
    parameters = {'file': 'vacation.jpg', 'size': 'original'} # resource specific params
    oauth_request = oauth.OAuthRequest.from_consumer_and_token(consumer, token=token, http_method='POST', http_url=RESOURCE_URL, parameters=parameters)
    oauth_request.sign_request(signature_method_hmac_sha1, consumer, token)
    print 'REQUEST (via post body)'
    print 'parameters: %s' % str(oauth_request.parameters)

src/n/o/noc-0.5/contrib/src/pysnmp/examples/v1arch/manager/setgen.py   noc(Download)
                print errorStatus.prettyPrint()
            else:
                for oid, val in pMod.apiPDU.getVarBinds(rspPDU):
                    print '%s = %s' (oid.prettyPrint(), val.prettyPrint())
            transportDispatcher.jobFinished(1)
    return wholeMsg
 

src/g/d/gdata-python-client-HEAD/samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py   gdata-python-client(Download)
    def put(self):
        """
        Extend put so that it writes vaules to memcache as well as the datastore,
        and keeps them in sync, even when datastore writes fails.
        """
        if self.session_key:
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
            self.dirty = False
            logging.info("doing a put")
            db.put(self)
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
        except:
            self.dirty = True
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
        if session_obj.sid == None:
            return None
        session_key = session_obj.sid.split('_')[0]
        session = memcache.get("_AppEngineUtilities_Session_" + str(session_key))
        if session:
            if session.deleted == True:
                session.delete()
                return None
            if session.dirty == True and session.working != False:
                # the working bit is used to make sure multiple requests, which can happen
                # with ajax oriented sites, don't try to put at the same time
                session.working = True
                memcache.set("_AppEngineUtilities_Session_" + str(session_key), session)
            if sessionAge.seconds > self.session_expire_time:
                results[0].delete()
                return None
            memcache.set("_AppEngineUtilities_Session_" + str(session_key), results[0])
            memcache.set("_AppEngineUtilities_SessionData_" + str(session_key), results[0].get_items_ds())
            logging.info('grabbed session from datastore')
            return results[0]
    def get_items(self):
        """
        Returns all the items stored in a session
        """
        items = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
        if items:
            for item in items:
    def get_item(self, keyname = None):
        """
        Returns a single item from the memcache or datastore
        """
        mc = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
        if mc:
            for item in mc:
        query.filter("keyname = ", keyname)
        results = query.fetch(1)
        if len(results) > 0:
            memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), self.get_items_ds())
            return results[0]
        return None
 
            results = query.fetch(1000)
            db.delete(results)
            db.delete(self)
            memcache.delete_multi(["_AppEngineUtilities_Session_" + str(self.session_key), "_AppEngineUtilities_SessionData_" + str(self.session_key)])
        except:
            mc = memcache.get("_AppEngineUtilities_Session_" + str(self.session_key))
            mc.deleted = True
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), mc)
        valid = False
        while valid == False:
            # verify session_key is unique
            if memcache.get("_AppEngineUtilities_Session_" + str(self.session_key)):
                self.session_key = self.session_key + 0.001
            else:
                query = _AppEngineUtilities_Session.all()
                else:
                    try:
                        self.put()
                        memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
                    except:
                        self.dirty = True
                        memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
            self.dirty = True
 
        # update or insert in memcache
        mc_items = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
        if mc_items:
            value_updated = False
            for item in mc_items:
                if value_updated == True:
                    break
                if item.keyname == self.keyname:
                    logging.info("updating " + self.keyname)
                    item.content = self.content
                    memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), mc_items)
            if value_updated == False:
                #logging.info("adding " + self.keyname)
                mc_items.append(self)
                memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), mc_items)
 
    def delete(self):
        """
        Deletes an entity from the session in memcache and the datastore
        """
        try:
            db.delete(self)
        except:
            self.deleted = True
        mc_items = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
                    item.deleted = True
                else:
                    mc_items.remove(item)
                memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), mc_items)
 
 
class _DatastoreWriter(object):
                duration = datetime.timedelta(seconds=self.session_token_ttl)
                session_age_limit = datetime.datetime.now() - duration
                if self.session.last_activity < session_age_limit:
                    logging.info("UPDATING SID LA = " + str(self.session.last_activity) + " - TL = " + str(session_age_limit))
                    self.sid = self.new_sid()
                    if len(self.session.sid) > 2:
                        self.session.sid.remove(self.session.sid[0])
    def new_sid(self):
        """
        Create a new session id.
        """
        sid = str(self.session.session_key) + "_" +md5.new(repr(time.time()) + \
                str(random.random())).hexdigest()
        return sid
            raise ValueError(keyname + ' is a reserved keyname.')
 
        if type(keyname) != type([str, unicode]):
            return str(keyname)
        return keyname
 
    def _put(self, keyname, value):
                self.cache[keyname] = pickle.loads(data.content)
                return pickle.loads(data.content)
            else:
                raise KeyError(str(keyname))
        raise KeyError(str(keyname))
 
    def __setitem__(self, keyname, value):
                simplejson.dumps(self.cookie_vals)
            print self.output_cookie.output()
        if bad_key:
            raise KeyError(str(keyname))
        if keyname in self.cache:
            del self.cache[keyname]
 

src/g/o/google-data-api-HEAD/samples/oauth/oauth_on_appengine/appengine_utilities/sessions.py   google-data-api(Download)
    def put(self):
        """
        Extend put so that it writes vaules to memcache as well as the datastore,
        and keeps them in sync, even when datastore writes fails.
        """
        if self.session_key:
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
            self.dirty = False
            logging.info("doing a put")
            db.put(self)
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
        except:
            self.dirty = True
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
        if session_obj.sid == None:
            return None
        session_key = session_obj.sid.split('_')[0]
        session = memcache.get("_AppEngineUtilities_Session_" + str(session_key))
        if session:
            if session.deleted == True:
                session.delete()
                return None
            if session.dirty == True and session.working != False:
                # the working bit is used to make sure multiple requests, which can happen
                # with ajax oriented sites, don't try to put at the same time
                session.working = True
                memcache.set("_AppEngineUtilities_Session_" + str(session_key), session)
            if sessionAge.seconds > self.session_expire_time:
                results[0].delete()
                return None
            memcache.set("_AppEngineUtilities_Session_" + str(session_key), results[0])
            memcache.set("_AppEngineUtilities_SessionData_" + str(session_key), results[0].get_items_ds())
            logging.info('grabbed session from datastore')
            return results[0]
    def get_items(self):
        """
        Returns all the items stored in a session
        """
        items = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
        if items:
            for item in items:
    def get_item(self, keyname = None):
        """
        Returns a single item from the memcache or datastore
        """
        mc = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
        if mc:
            for item in mc:
        query.filter("keyname = ", keyname)
        results = query.fetch(1)
        if len(results) > 0:
            memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), self.get_items_ds())
            return results[0]
        return None
 
            results = query.fetch(1000)
            db.delete(results)
            db.delete(self)
            memcache.delete_multi(["_AppEngineUtilities_Session_" + str(self.session_key), "_AppEngineUtilities_SessionData_" + str(self.session_key)])
        except:
            mc = memcache.get("_AppEngineUtilities_Session_" + str(self.session_key))
            mc.deleted = True
            memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), mc)
        valid = False
        while valid == False:
            # verify session_key is unique
            if memcache.get("_AppEngineUtilities_Session_" + str(self.session_key)):
                self.session_key = self.session_key + 0.001
            else:
                query = _AppEngineUtilities_Session.all()
                else:
                    try:
                        self.put()
                        memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
                    except:
                        self.dirty = True
                        memcache.set("_AppEngineUtilities_Session_" + str(self.session_key), self)
            self.dirty = True
 
        # update or insert in memcache
        mc_items = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
        if mc_items:
            value_updated = False
            for item in mc_items:
                if value_updated == True:
                    break
                if item.keyname == self.keyname:
                    logging.info("updating " + self.keyname)
                    item.content = self.content
                    memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), mc_items)
            if value_updated == False:
                #logging.info("adding " + self.keyname)
                mc_items.append(self)
                memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), mc_items)
 
    def delete(self):
        """
        Deletes an entity from the session in memcache and the datastore
        """
        try:
            db.delete(self)
        except:
            self.deleted = True
        mc_items = memcache.get("_AppEngineUtilities_SessionData_" + str(self.session_key))
                    item.deleted = True
                else:
                    mc_items.remove(item)
                memcache.set("_AppEngineUtilities_SessionData_" + str(self.session_key), mc_items)
 
 
class _DatastoreWriter(object):
                duration = datetime.timedelta(seconds=self.session_token_ttl)
                session_age_limit = datetime.datetime.now() - duration
                if self.session.last_activity < session_age_limit:
                    logging.info("UPDATING SID LA = " + str(self.session.last_activity) + " - TL = " + str(session_age_limit))
                    self.sid = self.new_sid()
                    if len(self.session.sid) > 2:
                        self.session.sid.remove(self.session.sid[0])
    def new_sid(self):
        """
        Create a new session id.
        """
        sid = str(self.session.session_key) + "_" +md5.new(repr(time.time()) + \
                str(random.random())).hexdigest()
        return sid
            raise ValueError(keyname + ' is a reserved keyname.')
 
        if not isinstance(keyname, str):
            return str(keyname)
        return keyname
 
    def _put(self, keyname, value):
                self.cache[keyname] = pickle.loads(data.content)
                return pickle.loads(data.content)
            else:
                raise KeyError(str(keyname))
        raise KeyError(str(keyname))
 
    def __setitem__(self, keyname, value):
                simplejson.dumps(self.cookie_vals)
            print(self.output_cookie.output())
        if bad_key:
            raise KeyError(str(keyname))
        if keyname in self.cache:
            del self.cache[keyname]
 

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/volume_analysis/vol_tasks.py   quickflash(Download)
 
for step in range(width_frac_steps) :
 
    options = prefix + " " + str(start_index) + " " + str(end_index) + " " \
              + str(flow_axis_index) + " " + layer_detection_dataset + " " \
              + str(envelope_min_value) + " " + str(envelope_max_value) \
              + " " + str(min_heav_value) + " " + str(max_heav_value) + " " \
              + str(bin_size) + " --sample-volume-width=" + str(width_frac_y) \
              + " --use-layer-width-fraction"
 
    outputname = outdir + "/" + prefix + "w" + str(width_frac_y) + ".out"
 
    cmd = command + " " + options + " > " + outputname
 
    stdout.write(str(job_counter) + " " + cmd + "\n")
 
    width_frac_y += delta_width_frac_y
    job_counter += 1
 
    width_y = width_lambda_y * lambda_len
 
    options = prefix + " " + str(start_index) + " " + str(end_index) + " " \
              + str(flow_axis_index) + " " + layer_detection_dataset + " " \
              + str(envelope_min_value) + " " + str(envelope_max_value) \
              + " " + str(min_heav_value) + " " + str(max_heav_value) + " " \
              + str(bin_size) + " --sample-volume-width=" + str(width_y)
 
    outputname = outdir + "/" + prefix + "l" + str(width_lambda_y) + ".out"
 
    cmd = command + " " + options + " > " + outputname
 
    stdout.write(str(job_counter) + " " + cmd + "\n")

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next