aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/configs/manager.py
Commit message (Collapse)AuthorAgeFilesLines
* configs: update "frequencies" property to be a numpy arrayAaron LI2017-08-281-6/+7
|
* configs: Use "utf-8" encoding to allow unicode in config filesAaron LI2017-08-271-6/+11
|
* configs/manager.py: Add formatter for handlersAaron LI2017-07-221-1/+8
| | | | Signed-off-by: Aaron LI <aly@aaronly.me>
* Fix parameter names about cosmologyAaron LI2017-07-211-2/+2
| | | | Signed-off-by: Aaron LI <aly@aaronly.me>
* configs/manager.py: Add property "cosmology"Aaron LI2017-07-211-0/+15
| | | | Signed-off-by: Aaron LI <aly@aaronly.me>
* configs/manager.py: get_path() return None if value is an empty stringAaron LI2017-07-211-2/+5
| | | | Signed-off-by: Aaron LI <aly@aaronly.me>
* galactic/synchrotron: Update to support sky.pyAaron LI2017-05-211-16/+32
| | | | | | | * Also update foregrounds.py to use sky.py * Minor fixes to configs/manager.py TODO: update synchrotron/add_smallscales() to also work with sky patch.
* configs: Use separate section "foregrounds" to config componentsAaron LI2017-05-161-1/+17
| | | | Also update copyright information.
* webui: configs: Some minor fixesAaron LI2016-11-221-5/+6
| | | | | | | | * configs.py/_set_configs(): Also return the original data if the input values failed the validation; * setServerConfigs(): Success callback also reset value if the input value failed pass the server-side validation; * getServerConfigs(): Return "undefined" if key does not exists.
* Add logging message on backing up old fileAaron LI2016-11-211-0/+1
|
* configs/manager.py: Make a backup when output file already existsAaron LI2016-11-161-4/+15
| | | | Also expand the output file for the prefix "~" (tilde)
* configs/manager.py: Also dump the "userconfig" valueAaron LI2016-11-161-1/+4
|
* configs/manager.py: Keep configuration file commentsAaron LI2016-11-151-6/+12
| | | | | | | | | | * Enable the "copy" mode when validating, which also copies all the comments from the configspec to the validated configurations; * Use "copy.deepcopy()" to make a deep copy of the configurations, which also copies all the comments. Since the comments are preserved, therefore they are also written together to the saved/output configuration file.
* configs/manager.py: Expand "~" when read userconfigAaron LI2016-11-151-0/+3
|
* configs/manager.py: Implement the "save()" methodAaron LI2016-11-081-6/+19
|
* configs: Change "logging/filemode" to boolean "logging/appendmode"Aaron LI2016-11-071-1/+1
| | | | | * Update the "logging" property in "manager.py" * Also add "extragalactic/clusters" to "common/components"
* configs/manager.py: Replace a filter with list comprehensionAaron LI2016-11-071-4/+1
| | | | | Replace the filter hack with a cleaner list comprehension. Be Pythonic :)
* configs/manager.py: Support flattening dumped configs (nested dict)Aaron LI2016-11-061-6/+98
| | | | | | | | * Add helper function "_flatten_dict()" to flatten a nested dictionary into an one-level dictionary, with the keys are concatenated with a separator. * Add a new parameter "flatten" to method "dump()" to allow the dumped configurations been flattened.
* webui: websocket.py: Implement "set" action for "_handle_configs()"Aaron LI2016-11-041-5/+5
| | | | | | | Finish the "_set_configs()" function to implement the "set" action for "_handle_configs()". Also change the "status" keyword to "success" to be more intuitive.
* configs/manager.py: Add method "check_all()" using "check_configs()"Aaron LI2016-11-041-0/+31
|
* configs/manager.py: Implement "setn()" to set an option valueAaron LI2016-11-041-6/+86
| | | | | | | | | | | The "setn()" method is a corresponding operation with the "getn()", which set the value of a config option to the given value. This function will be used in the Web UI to interact with the WebSocket communications. Also add the "merge()" method which simply merge the input configurations without any validation.
* configs/manager.py: getn(): remove par. "sep"; handle exceptionAaron LI2016-11-031-12/+16
| | | | | | | | * Remove the optional parameter "sep", therefore the key must be "/"-separated or a list of keys. * Add exception handling and raise "KeyError" if the input key is invalid (i.e., specifies a non-exist option). * Update comments and docstring.
* configs/manager.py: Reset before loading user config file againAaron LI2016-11-031-12/+10
| | | | | | | | Originally, the user configuration file is only allowed to load once, and prevent any future loading of user configuration file. This change allows load user configuration file again by resetting the current configurations to defaults before loading.
* configs/manager.py: Add method "reset()" and attribute "userconfig"Aaron LI2016-11-031-1/+16
|
* configs/manager.py: Keep a copy of default configs; Add "dump()"Aaron LI2016-11-021-5/+42
| | | | | | | | * Keep a copy of the default configurations from the specifications * Add "dump()" method to dump the configurations (as well as the default configurations) as plain Python dictionary * Add new parameter "from_default" to methods "get()" and "getn()" to allow get the config value from the default configurations
* configs/manager.py: Update docstring and commentAaron LI2016-10-191-3/+9
|
* configs/manager.py: Fix the bug that breaks specifications loadingAaron LI2016-10-171-1/+4
| | | | | | | The "filter()" returns an iterator, that is consumed after the use, therefore, the "specfiles" is used by the print under "DEBUG_FG21SIM". Then "specfiles" is empty and thus prevents the reading of the specification files.
* Force "DEBUG" log level if env variable "DEBUG_FG21SIM" setAaron LI2016-10-171-2/+6
|
* configs/manager.py: Change __init__() to load user configAaron LI2016-10-171-9/+15
| | | | | | | | Change the "__init__()" method to load the user configurations (i.e., by invoke the "read_userconfig()" method) instead of loading extra general configurations. Method "getn()": also check the validity for the parameter "sep".
* configs/manager.py: Various updates to docstring and comments.Aaron LI2016-10-171-23/+44
| | | | No functional changes.
* configs: Update get_path() to take care None and non-string valueAaron LI2016-10-151-3/+24
| | | | | | * Return None if specified config is None or not exist * Raise ValueError if specified config is non-string * Update comments
* configs: Switch to use `pkg_resources` to access config specsAaron LI2016-10-151-10/+19
| | | | | | | | | After this switch to `pkg_resources`, this package can also be installed as an EGG (a zip archive), which is more generic. References: * http://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access * http://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files
* configs: Support env variable "DEBUG_FG21SIM" for debuggingAaron LI2016-10-141-0/+3
| | | | | | Since the logging is not avaiable at the moment, we can only use the plain `print` for debugging, if the environment variable "DEBUG_FG21SIM" is defined.
* Fix wrong config syntax and minor changes to ConfigManagerAaron LI2016-10-041-8/+14
|
* configs/manager.py: Add logging supportAaron LI2016-10-041-2/+6
|
* configs/manager.py: Add method "get_path()"Aaron LI2016-10-041-0/+21
|
* configs/manager.py: Add method "read_userconfig()"Aaron LI2016-10-041-3/+35
| | | | | | | | This "read_userconfig()" method is specifically used to load the user configuration file, and record the absolute path of the configuration file, which allows the use of relative path to specify the input files (e.g., galactic/synchrotron/template) for simulation within the configurations.
* configs/manager.py: Fix a bug that "_validate()" not workingAaron LI2016-10-041-1/+1
|
* configs/manager.py: Add "frequencies" propertyAaron LI2016-10-041-0/+16
| | | | | The "frequencies" property will return or calculate the frequency values of the simulation.
* Arrange customs errors/exceptions in a moduleAaron LI2016-10-031-4/+1
|
* configs/manager.py: Add "getn()" method to get multi-level config valueAaron LI2016-10-021-0/+25
|
* configs/manager.py: Refactor "get()" method and remove "set()"Aaron LI2016-10-021-8/+1
|
* configs/manager.py: Make "validate()" method private.Aaron LI2016-09-301-8/+8
| | | | Also unify the quote style.
* configs/manager.py: Update docstrings.Aaron LI2016-09-301-2/+21
| | | | The NumPy docstring style is used.
* utils/logging: reset handlers before initialization/reconfigurationAaron LI2016-09-291-1/+7
| | | | Also improve the comments.
* configs/manager.py: Add "filemode" to the logging dictAaron LI2016-09-291-1/+3
|
* configs: Fix ConfigError and disable interpolationAaron LI2016-09-291-3/+9
| | | | | | Since we do not use string interpolation in configs, so disable this feature, otherwise `MissingInterpolationOption` error happens due to the "logging" configs which contains string formats.
* configs/manager.py: Add property "logging"Aaron LI2016-09-291-2/+28
| | | | | | | This "logging" property get and perpare the configurations for `logging.basicConfig()` use. Needs testing.
* Implement the basic ConfigManger()Aaron LI2016-09-271-0/+74
This is very basic at the moment, and needs many improvements. Thanks: https://github.com/pazz/alot TODO: Add config specifications with default values