ism3d package

Submodules

ism3d.cli module

import ism3d from ism3d.utils import rng_seeded print(ism3d.fft_use) print(rng_seeded(None))

ism3d.cli.main()[source]

Parse options and launch the workflow

ism3d.cli.proc_inpfile(args=None)[source]

ism3d.interface module

ism3d.interface.eval_func(vs_func_ps, var_dict)[source]

Do an inline calculation from a string expression in a lambda function-like syntax

1st: element

exprexpected to be a tuple
expr[0] string:

lamabda function-like syntax defining a anonymous function and its variable(s) the variables’ name and content should exist in the dictionary “locals”

expr[1],expr[2],expr[3]

function parameters

output:

the function’s value at each points of variables under the given parameters

example:

eval_func((‘rho : minimum(rho/p2,1.0)*p1’,200*u.km/u.s,5*u.kpc),locals())

the function call will calculate “minimum(rho/p2,1.0)*p1” assuming p1=200*u.km/u.s & p2=5*u.kpc at each “rho” value. Here, “rho” is a local-scope variable containing a numpy array

ism3d.interface.inp_to_mod(inp_dict)[source]
ism3d.interface.key_intepreter(key, value)[source]

additional customized interpretaion of key values

ism3d.interface.read_inp(parfile, log=False)[source]
read parameters/setups from a .inp file into a dictionary nest:

inp_dct[id][keywords]=values. inp_dct[‘comments’]=’??’ inp_dct[‘changlog’]=’??’ inp_dct[‘optimize’]=’??’

keyword value formatting

1.remove trailing/prefix space / comments 2.split my space 3.first element is the key 4.the rest elements will be filled into value

more than one element : list one element: scaler

ism3d.interface.write_inp(inp_dict, parfile='test,inp', overwrite=True)[source]

ism3d.ism3d module

Main module.

ism3d.logger module

class ism3d.logger.CustomFormatter(fmt=None, datefmt=None, style='%', validate=True)[source]

Bases: logging.Formatter

customized logging formatter which can handle mutiple-line msgs

format(record: logging.LogRecord)[source]

Format the specified record as text.

The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.

ism3d.logger.casalogger_config(logfile=None, loglevel='INFO', onconsole=True, reset=False)[source]

Set CASA log file use reset=True when you don’t want the last casa log file (which could be autmatically created when import casataks)

ism3d.logger.casalogsink_config(logfile=None, loglevel='INFO', onconsole=True)[source]

obselete casatools.logsink can create a casalogger instance import casatasks will initialize a casalogger instance the casa logger setup will be initilized with “import casataks”

to prevent this, we need the casalogger configuration at the toolkit ahead of import casatasks

ism3d.logger.logger_config(logfile=None, loglevel='INFO', logfilelevel='INFO', reset=True, log2term=True)[source]
set up a customized logger,e.g.,
>>>ism3d.logger_config(logfile=’logs/test_ism3d.log’,

loglevel=logging.WARNING, logfilelevel=logging.INFO)

note: this will merge the logging output from ism3d and casa6 into a single log file. loglevel=’INFO’/’WARN’/’DEBUG’

ism3d.logger.logger_status()[source]

print out the current status of ism3d logger

Module contents

Top-level package for ism3d.