Commit Graph
100 Commits
Author SHA1 Message Date
Wirawan Purwanto 10047b26f9 * Module wpylib.math.linalg.gram_schmidt to orthonormalize a set of
columns vectors.
2015-04-01 15:46:48 -04:00
Wirawan Purwanto a3add89f5a * Added simple tools to read/write values to/from a HDF5 file. 2015-04-01 12:56:19 -04:00
Wirawan Purwanto b7f1cbaa5c * In tmpdir cleanup: Replaced stray debug printout with a warning msg if
tmpdir is not to be cleaned up.
2015-03-18 14:12:10 -04:00
Wirawan Purwanto 7568f5874e * Added a tool to create bound instance method with weak ref to the instance. 2015-03-16 18:07:18 -04:00
Wirawan Purwanto 1c5ec91b64 * Added method idatetime.join_values() . 2015-03-12 23:47:48 -04:00
Wirawan Purwanto 86e4e8fd51 * Bugfixes for tmpdir. 2015-02-10 17:39:03 -05:00
Wirawan Purwanto c9fdeee86b Merge remote-tracking branch 'origin/master' 2014-12-09 23:56:45 -05:00
Wirawan Purwanto 9a4f4d782b * Added first implementation (and test harness) for idatetime
datatype.
2014-10-16 15:56:16 -04:00
Wirawan Purwanto 10ee70427c * Upgraded utime_to_iso function to include more formatting. 2014-10-16 14:26:19 -04:00
Wirawan Purwanto 4f82c80af9 * Documentation & test update. 2014-10-15 10:12:49 -04:00
Wirawan Purwanto d841380864 * Added class wpylib.math.stats.avg.weight_stats for weighted statistical
analysis.
2014-09-04 17:44:50 -04:00
Wirawan Purwanto 5c177065dd * Added block_timer class for use in python 2.5+ "with ..." construct. 2014-08-27 22:24:59 -04:00
Wirawan Purwanto 3e0d86fdfb * Added array_hstack function. 2014-08-27 22:23:20 -04:00
Wirawan Purwanto 7d5bf9e7f8 * Added simple text table reader. 2014-08-27 22:22:59 -04:00
Wirawan Purwanto 22d5b6f888 * Added class logged_runner for logging external programs called from
a python script.
2014-08-19 11:09:46 -04:00
Wirawan Purwanto 3ee3dd5c4b * Module wpylib.file.tmpdir: defines a script-wide temporary directory. 2014-08-19 11:07:39 -04:00
Wirawan Purwanto d7a65386a3 * Fortran binary file: Added bulk_read_array1 method for quick reading of
array of (uniform-type) Fortran records.
2014-08-19 11:06:08 -04:00
Wirawan Purwanto 02a0222f34 * wpylib.file.file_utils: added is_readable/is_writable test functions. 2014-08-02 22:10:58 -04:00
Wirawan Purwanto f3f47f658e * Added tester for wpylib.iofmt submodules and objects: first test is for
text_output "with" invocation.
2014-08-02 21:34:12 -04:00
Wirawan Purwanto 025d410ec4 * Moved test modules to a separate TESTS subdirectory to avoid confusion. 2014-08-02 21:33:35 -04:00
Wirawan Purwanto 723f1a4fc1 * Added __enter__/__exit__ method for use with python 2.5's "with" statement. 2014-08-02 21:32:34 -04:00
Wirawan Purwanto fd47842b73 * Documentation update. 2014-08-02 21:17:54 -04:00
Wirawan Purwanto b0c524e5a8 * Added more test harness (test 3) for dict_update_nested(). 2014-06-05 12:47:44 -04:00
Wirawan Purwanto 6c8c2d8381 * Added: dict_update_nested() for nested dict member copy-update into
the destination.
* Added most basic test harnesses for that routine.
2014-06-05 11:30:47 -04:00
Wirawan Purwanto 17b9ed5585 * For auto param _create_() function: added _skipframes_ option, if needed.
* Added support for __flatten_dict__() function.
2014-05-30 18:22:22 -04:00
Wirawan Purwanto 1eaeb3e68c * Added function: dict_defval and dict_defvals. 2014-05-29 13:55:16 -04:00
Wirawan Purwanto 597398a34b * Added missing function (rms). 2014-05-29 13:55:05 -04:00
Wirawan Purwanto bb3db2667a * Module array_stat: Added study_sparsity() and print_histogram(),
adapted from V2b_inspect research module.
2014-04-17 16:42:36 -04:00
Wirawan Purwanto aaa06dc531 * Added rdiff() function to calculate element-wise relative difference of
two arrays.
2014-04-17 13:33:59 -04:00
Wirawan Purwanto a0d8ed87a3 * New module: wpylib.array_tools for convenient array manipulations. 2014-04-07 12:27:08 -04:00
Wirawan Purwanto 8da8937009 * Added function str_indent for completeness. 2014-04-07 12:26:09 -04:00
Wirawan Purwanto a347ae6d47 * New module: wpylib.math.stats.array_stats, for studying statistics of
an array (e.g., sparsity, difference, etc).
2014-04-07 12:25:33 -04:00
Wirawan Purwanto 3b0a8af1aa * Added MathWarning for mathematics-related warning messages. 2014-03-28 14:29:10 -04:00
Wirawan Purwanto 04e78ade1d * Added extra debugging statements. 2014-02-24 16:06:40 -05:00
Wirawan Purwanto 1e56bb95eb * wpylib.file.file_utils: added path_prep and mkdir_p. 2014-02-24 16:06:09 -05:00
Wirawan Purwanto b043fb3cdf * fit_func: Added support for lmfit-based minimization.
Tested minimally in the Cr2_analysis_cbs.py workbench (routine:
  Test_MC_FPTZ_20140206).
2014-02-07 18:25:22 -05:00
Wirawan Purwanto 363999badf * Added str_lstrip, str_rstrip functions for a Bourne-like substring
stripping.
2014-01-31 10:07:05 -05:00
Wirawan Purwanto 4fbf85d503 * Added function_name to obtain the name given to a function. 2014-01-31 10:06:33 -05:00
Wirawan Purwanto 839948a8da * Moved the following functions from wpylib.shell_tools to
wpylib.file.file_utils since they are not directly related to shell:

  - file_exists_nonempty
  - is_executable_file
  - dirname2
  - relpath
  - path_split_all
  - list_dir_entries

  These are new API functions, so hopefully their changes would not
  affect many existing scripts.

* Added support for xz-compressed tar in untar() routine. Untested.

* Documentation updates.
2014-01-16 12:31:57 -05:00
Wirawan Purwanto 0c352b44f7 * Added function scan_directories() -- initial version for scanning
recursively all through directories (no symlink following), to collect
  all subdirectories that satisfy the test criteria defined in the
  testdir() function argument.
2014-01-16 11:58:51 -05:00
Wirawan Purwanto d93fb5b7c2 * Added support for .xz file extension.
* Using backported lzma module (on python <= 3.2) to eliminate subprocess,
  if possible.
2014-01-15 16:39:00 -05:00
Wirawan Purwanto 5ce6e86b43 * Added functions: is_executable_file() and path_split_all(). 2014-01-15 16:37:29 -05:00
Wirawan Purwanto a33ad3c766 * Introduced a much faster way (and simpler) to compute jackknife averages. 2013-12-11 16:25:29 -05:00
Wirawan Purwanto 4e2b2c66c2 * Added wpylib.math.stats.jackknife1, initial implementation of delete-one
jackknife resampling method.

  This module also contains a hack for weighted average
  (warning: the theory is not established yet, at least I have not seen
  it).
2013-12-11 00:15:24 -05:00
Wirawan Purwanto f0ba6f4068 * wpylib.math: Added complex_polar(). 2013-12-09 17:27:44 -05:00
Wirawan Purwanto 093b15085b * utime_to_iso(): Let the local current time be the default input data. 2013-10-23 13:15:02 -04:00
Wirawan Purwanto 0675c6c599 * Added wpylib.datetime.utime_to_iso() function. 2013-10-23 13:04:48 -04:00
Wirawan Purwanto 42babbe767 * Add "global variable" statement. 2013-10-23 13:03:49 -04:00
Wirawan Purwanto 869aa91109 * fit_func(): Allow non-(numpy.ndarray) args for x, y, dy.
* Documentation update.
2013-10-17 13:49:50 -04:00
Wirawan Purwanto fb6631f756 * Use is_iterable to detect iterable specs argument. 2013-10-17 13:49:17 -04:00
Wirawan Purwanto 9a5d2dfa9f * text_tools: Added str_fmt_heading() function for formatting table heading
a la printf.
2013-10-17 13:48:07 -04:00
Wirawan Purwanto 579be3e18a * errorbar: Added "lazy" string evaluation to speed up errorbar algebra. 2013-10-02 15:32:46 -04:00
Wirawan Purwanto ed1242dc66 * Added "lazy string printout" which will speed up errorbar algebra--i.e.
we only need to evaluate the string representation when
  the string printout isrequired.
2013-10-02 14:30:55 -04:00
Wirawan Purwanto c8aad2e2f8 * Added facility for smoothed approximating spline instead of "exact"
interpolation.
2013-09-17 18:00:08 -04:00
Wirawan Purwanto 06fa307e84 * spline_2d: Use public scipy API functions. 2013-09-17 17:18:29 -04:00
Wirawan Purwanto 564d1f4364 * wpylib.math.fitting.fit_func: Added support for weight (or y uncertainty).
* For `leastsq' fit method, also introduced 'xerr' output (in outfmt=0)
  as the error estimate of the fitted parameters.
2013-08-19 15:43:49 -04:00
Wirawan Purwanto 37b0939671 * Documentation clarification. 2013-08-19 15:43:19 -04:00
Wirawan Purwanto 1421cf3bc5 * wpylib.math.fitting.fit_func: Allow Guess argument to override
machine-generated guess.
* Add 'funcalls' data key to the leastsq complete output to conform to the
  fmin-style output.
2013-08-19 10:50:54 -04:00
Wirawan Purwanto 2907b2ca77 * Set lcg48 default seed_index for user's reference 2013-08-19 10:11:09 -04:00
Wirawan Purwanto 42fdcc5253 * Added new module wpylib.math.random and its submodule (rng_lcg48).
The LCG48 generator is primarily for testing algorithms involving random
  numbers.
2013-08-14 15:29:26 -04:00
Wirawan Purwanto e485cabbe8 * wpylib.math.fitting.fit_func: Added optional Funct_hook argument to
be called (for debugging purposes) every time "the" Funct function
  is called.
2013-08-13 01:05:38 -04:00
Wirawan Purwanto cdad14e034 * Added BFGS minimization. 2013-08-09 16:51:38 -04:00
Wirawan Purwanto 2e21e2857a * Added function relpath() to compute relative path from one to another
path.
2013-06-25 17:01:26 -04:00
Wirawan Purwanto 2daca4af6e * tee_output: Allow None to be given in the `files' argument, which stands
for a null file.
2013-04-19 16:46:09 -04:00
Wirawan Purwanto 80961ed2bd * Added test7 and test8 for param_flat module.
- test7 tests active parameters which can work OK if the search dicts are
    flatten.
  - test8 tests the _flatten_() method.
2013-04-17 17:26:48 -04:00
Wirawan Purwanto b326937d80 * Parameters: Now correctly implements _flatten_() method and flag.
- The _flatten_() method should recursively flatten the parameter
    search space into a single dict.
  - The _flatten_ flag will flatten the input dicts and keyword-based
    parameter (in the __init__() method only) in the expected order of
    priority (where the first found keyword is the most overriding one)
    into a single search dict.
2013-04-16 14:06:26 -04:00
Wirawan Purwanto 8d32c2c067 * Parameters: if _flatten_ is enabled, must flatten in reverse order to
give the firstly mentioned dict the priority.
2013-04-16 11:55:18 -04:00
Wirawan Purwanto 254aaca622 * Added tester for active Parameters value. 2013-04-11 14:38:04 -04:00
Wirawan Purwanto 0f58bc0f03 * params_flat.py: Added ActiveReadValue magic class to enable `active',
or executable, parameter, which will be executed upon `reading' such a
  value.
2013-04-11 14:36:52 -04:00
Wirawan Purwanto fe9fa59e76 * params_flat.py: Documentation and note updates. 2013-04-11 14:06:14 -04:00
Wirawan Purwanto f7c9ad7d34 * Added functions time_diff() and shift_time() for UNIX time manipulation. 2013-03-05 23:44:31 -05:00
Wirawan Purwanto 8f513ff5b4 * Added tests for Parameters._all_keys(). 2013-03-04 13:59:26 -05:00
Wirawan Purwanto 6709679af9 * Parameters: Added _all_keys_() and _flatten_() methods.
Warning: These are expensive, and not for general use.
2013-03-04 13:58:32 -05:00
Wirawan Purwanto 5a84a98b84 * Added tests for _append_() and _prepend_() methods. 2013-03-04 13:42:22 -05:00
Wirawan Purwanto f04531a601 * Parameters: Added _append_() and _prepend_() methods. 2013-03-04 13:37:48 -05:00
Wirawan Purwanto 099f3e7e06 * Module wpylib.db.indexing_float: utility for floating-point (FP)-based
indexing, allowing tolerances to account for imprecise nature of FP
  numbers.

  Initial implementation, rather complicated.
  A simple rounding-based implementation can be put in later.

  Includes initial test.
2013-03-03 09:15:43 -05:00
Wirawan Purwanto 4fb16c56b2 * Documentation update. 2013-02-28 14:01:18 -05:00
Wirawan Purwanto 9de8407dd9 * Added Test_3(). 2012-10-15 17:25:06 -04:00
Wirawan Purwanto a0eb82ed2b * Mute debug printing. 2012-10-15 16:59:35 -04:00
Wirawan Purwanto 5b213b0ee7 * Little syntax optimization. 2012-10-15 16:45:37 -04:00
Wirawan Purwanto 414643ecde * Added testcase wpylib.math.fitting.linear.Test_2() against numpy.polyfit(). 2012-10-15 16:35:12 -04:00
Wirawan Purwanto cb8124f699 * Provide uncertainty of both a and b fit parameters. 2012-10-15 16:12:37 -04:00
Wirawan Purwanto 87763d6e57 * wpylib.math.fitting.linear: for linear fit methods.
First method: linregr2d_SZ() from Shiwei's email in 2006.
2012-10-15 16:02:41 -04:00
Wirawan Purwanto 908a4e0682 * Rebase fit_result on result_base. 2012-10-15 16:01:46 -04:00
Wirawan Purwanto 348c204699 * Change wpylib.math.fitting module from a file into a subdirectory. 2012-10-15 15:16:02 -04:00
Wirawan Purwanto 332d9ae240 * wpylib.math: added choose() function. 2012-08-24 16:32:33 -04:00
Wirawan Purwanto b58ea30ba8 * Added a facility to catch exception while capturing stdout, and deliver
the output printed so far (to stderr), plus re-raising the exception.
2012-08-24 16:31:48 -04:00
Wirawan Purwanto f677dc1a81 * Added wpylib.py.stdout_capture as a hack tool to capture sys.stdout
output of a given function call (and its child subroutines).
2012-08-10 10:13:18 -04:00
Wirawan Purwanto 17d242213d * Added some useful functions from my pw2g_bench_MnO.py scriptlet collection:
- wpylib.math.roundup()
  - wpylib.shell_tools.dirname2()

* file_exists_nonempty() is moved to wpylib.shell_tools.
2012-07-25 09:40:37 -04:00
Wirawan Purwanto 96cec22fca * wpylib.file.file_utils: added file_exists_nonempty() function. 2012-07-24 17:11:36 -04:00
Wirawan Purwanto 7ebb4004dc * str_igrep(): use enumerate function. 2012-06-13 19:36:35 -04:00
Wirawan Purwanto d70bcf2149 * In text_output methods, do the required action iff self.out is not None. 2012-06-13 19:35:06 -04:00
Wirawan Purwanto 81316af285 * Added os.path-like methods: isdir, isfile, islink.
The last one is not reliable, but is added for uniformity for the time
  being.
2012-06-03 20:35:40 -04:00
Wirawan Purwanto dcb7fa304c * Added sftp_client.put() method.
* Added sftp_status_callback class.
2012-05-26 08:37:01 -04:00
Wirawan Purwanto 6433e5da3c * Added prefix and suffix options for matrix_str and vector_str. 2012-05-23 00:25:42 -04:00
Wirawan Purwanto 140b3b699c * Added wpylib.interactive_tools.printstr class to facilitate logging of
print-ed output in interactive python sessions.
2012-05-17 12:29:30 -04:00
Wirawan Purwanto 5c72506135 * New module: wpylib.file.tee
* Added class tee_output for splitting text output to multiple destinations.
2012-05-14 15:48:43 -04:00
Wirawan Purwanto ad841e0b90 * text_input.read_items(): added option end_line_match' and last_line_match'
(mutually exclusive options) to allow the dataset reading to end upon
  encountering certain text pattern (or a more complicated match, if we
  specify a function for the option value).
  These options can be used to work with the `maxcount' option; the shortest
  of the two (maxcount records read first, or end/last_line_match finds a
  match) will end the reading of the dataset.
2012-04-17 11:03:29 -04:00
Wirawan Purwanto 501552a65a * Added zip_gen() to simulate the effect of built-in zip() function, but
implemented as a generator rather than yielding the list right away.
  This is used mainly in loops, where we don't want to generate all the
  elements due to memory concerns.
2012-04-17 11:00:30 -04:00
Wirawan Purwanto 606214eb66 * Changing all isinstance(STUFF, str)' to isinstance(STUFF, basestring)'
for future-proofing this code.
2012-04-13 17:10:32 -04:00