Table Of Contents

Previous topic

ScatPy.targets

This Page

ScatPy.utils

Utility functions.

Function Summary

gauss(x, sigma)
r_parser(k)
L_parser(k)
weighted_gauss(c, parser, sigma) Make a Normalized-Gaussian weighted sum of a range of spectras obtained with a series of simulations sweeping on a folder-collection names obtained parameters (e.g.
str2pol(s) Convert a string into a complex three vector indicating the polarization
normalize(v) Normalizes a 3D complex vector
n_dist(v1, v2) The distance between two nromalized complex vectors
pol2str(v) Convert a vector into a string
compexV2str
str2complexV(s) Convert a string to a complex vector
resolve_mat_file(material) Return an absolute file name pointing to a material file
resolve_profile(fname) Resolve the absolute file name of the requested profile file.
compress_files([folder, recurse]) Zips all the support file output by ddscat into one archive
MixMaterials(m1, m2, p1) Approximate the index for alloys by a weighted average of the two components

Class Definitions

Utility functions.

ScatPy.utils.L_parser(k)[source]
ScatPy.utils.MixMaterials(m1, m2, p1)[source]

Approximate the index for alloys by a weighted average of the two components

ScatPy.utils.complexV2str(v)[source]

Convert a complex three-vector into a string of three tuples

ScatPy.utils.compress_files(folder=None, recurse=False)[source]

Zips all the support file output by ddscat into one archive

Collects all .avg, .sca, .fml files into their own zip file. These can be accessed conveniently with a ZipCollection result object

The option recurse=True does the same on all subdirectories.

ScatPy.utils.gauss(x, sigma)[source]
ScatPy.utils.make_profile()[source]

Create a local profile in user’s home folder.

ScatPy.utils.n_dist(v1, v2)[source]

The distance between two nromalized complex vectors

ScatPy.utils.normalize(v)[source]

Normalizes a 3D complex vector

ScatPy.utils.pol2str(v)[source]

Convert a vector into a string

The helicity convention used for named polarizations is determined by the values of the polarization constants in core.

ScatPy.utils.r_parser(k)[source]
ScatPy.utils.resolve_mat_file(material)[source]

Return an absolute file name pointing to a material file

If the path is already absolute then return that. If it’s relative return that with ~ expanded If it’s only a filename, assume that file is found in the materials library

ScatPy.utils.resolve_profile(fname)[source]

Resolve the absolute file name of the requested profile file.

Parameters:fname – The name of the file to find
Returns:Absolute path to the file. None if not found.

The search scheme is to first look for the file in the CWD, followed by the folder ~/.ScatPy/ and finally the subdiretory profiles/ relative to where the utils.py module resides.

ScatPy.utils.str2complexV(s)[source]

Convert a string to a complex vector

ScatPy.utils.str2pol(s)[source]

Convert a string into a complex three vector indicating the polarization

Attempts to identify polarizations by name: ‘cl’, ‘cr’, ‘lh’, ‘lv’

The helicity convention used for named polarizations is determined by the values of the polarization constants in core.

ScatPy.utils.weighted_gauss(c, parser, sigma)[source]

Make a Normalized-Gaussian weighted sum of a range of spectras obtained with a series of simulations sweeping on a folder-collection names obtained parameters (e.g. r or L) from the parser functions

It is written on the data structure obtained from the results.FolderCollection