diff --git a/README.md b/README.md index 598b9c1c9e846089ec53b962074b8240c140a741..e26f3466673e74aa4db0f44440317163c7d120f2 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,8 @@ Make sure that with every change/recompilation you make in `binary_c`, you also ### Documentation Look in the docs/ directory. Within the build/html/ there is the html version of the documentation. The documentation is also hosted on http://personal.ph.surrey.ac.uk/~ri0005/doc/binary_c/binary_c.html but only for the most recent stable release. +This documentation is hosted on gitlab-pages through a gitlab-runner that executes the contents of `.gitlab-ci.yml`. The runner copies the contents of `docs/build/html` to `public/`. + ## Development: If you want to contribute to the code, then it is recommended that you install the packages in `development_requirements.txt`: diff --git a/VERSION b/VERSION index a602fc9e283389306d606c164ce73ac338999373..b0bb878545dc6dc410a02b0df8b7ea9fd5705960 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.4 +0.9.5 diff --git a/binarycpython/__init__.py b/binarycpython/__init__.py index 5d82f47b270e7d0a3e133c27d941ba69ae8ce0fa..50bf4c641de7e69b653bb5169adf8650191ea600 100644 --- a/binarycpython/__init__.py +++ b/binarycpython/__init__.py @@ -1,7 +1,5 @@ """ Init function for binarycpython module - -Make population accessible here """ from binarycpython.utils.grid import Population diff --git a/binarycpython/utils/ensemble.py b/binarycpython/utils/ensemble.py index 4c27268e0d52612a593c33515948525a9ae5549f..a1d3e7b5c47190c6400b21d42ace899f773cc863 100644 --- a/binarycpython/utils/ensemble.py +++ b/binarycpython/utils/ensemble.py @@ -115,7 +115,12 @@ def ensemble_file_type(filename): def load_ensemble( - filename, convert_float_keys=True, select_keys=None, timing=False, flush=False + filename, + convert_float_keys=True, + select_keys=None, + timing=False, + flush=False, + quiet=False ): """ Function to load an ensemeble file, even if it is compressed, @@ -129,7 +134,8 @@ def load_ensemble( # open the file # load with some info to the terminal - print("Loading JSON...", flush=flush) + if quiet == False: + print("Loading JSON...", flush=flush) # open the ensemble and get the file type file_object = open_ensemble(filename) @@ -142,47 +148,64 @@ def load_ensemble( ) sys.exit() - with Halo(text="Loading", interval=250, spinner="moon", color="yellow"): + if quiet == True: tstart = time.time() - _loaded = False - - def _hook(obj): - """ - Hook to load ensemble - """ - - nonlocal _loaded - if _loaded is False: - _loaded = True - print( - "\nLoaded {} data, now putting in a dictionary".format(filetype), - flush=True, - ) - return obj - if filetype == "JSON": - # orjson promises to be fast, but it doesn't seem to be - # and fails on "Infinity"... oops - # data = orjson.loads(file_object.read()) - - # simplejson is faster than standard json and "just works" - # on the big Moe set in 37s - data = simplejson.load(file_object, object_hook=_hook) + data = simplejson.load(file_object) file_object.close() - - # standard json module - # on the big Moe set takes 42s - # data = json.load(file_object, - # object_hook=_hook) elif filetype == "msgpack": data = msgpack.load(file_object, object_hook=_hook) file_object.close() - if timing: print( "\n\nTook {} s to load the data\n\n".format(time.time() - tstart), flush=True, ) + else: + with Halo(text="Loading", interval=250, spinner="moon", color="yellow"): + tstart = time.time() + _loaded = False + + def _hook(obj): + """ + Hook to load ensemble + """ + + nonlocal _loaded + if _loaded is False: + _loaded = True + print( + "\nLoaded {} data, now putting in a dictionary".format(filetype), + flush=True, + ) + return obj + + if filetype == "JSON": + # orjson promises to be fast, but it doesn't seem to be + # and fails on "Infinity"... oops + # data = orjson.loads(file_object.read()) + + # simplejson is faster than standard json and "just works" + # on the big Moe set in 37s + if quiet == False: + data = simplejson.load(file_object, object_hook=_hook) + else: + data = simplejson.load(file_object) + file_object.close() + + # standard json module + # on the big Moe set takes 42s + # data = json.load(file_object, + # object_hook=_hook) + elif filetype == "msgpack": + data = msgpack.load(file_object, object_hook=_hook) + file_object.close() + + if timing: + print( + "\n\nTook {} s to load the data\n\n".format(time.time() - tstart), + flush=True, + ) # strip non-selected keys, if a list is given in select_keys if select_keys: diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index a55f231ca31c2b8aed15e13b40ca444d538de176..48e66171195d1c9b21d0424a7b0f3958f6ff9a31 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -1267,12 +1267,10 @@ class Population( for output_dict in iter(result_queue.get, sentinel): if output_dict: # don't let Xinit be added - if ( - "ensemble_results" in combined_output_dict - and "ensemble" in combined_output_dict["ensemble_results"] - and "Xinit" in combined_output_dict["ensemble_results"]["ensemble"] - ): + try: del combined_output_dict["ensemble_results"]["ensemble"]["Xinit"] + except: + pass # merge dicts combined_output_dict = merge_dicts( diff --git a/install.sh b/install.sh index 42f91d61275ba2e570618dc5aaf7f08a45d9f5c3..f3204fd55025a2f06ec3ee9f9110cd750ee060af 100755 --- a/install.sh +++ b/install.sh @@ -13,7 +13,7 @@ echo "installing binarcpython version $VERSION_NUMBER" # do stuff... $PYTHON setup.py clean -$PIP uninstall binarycpython +$PIP uninstall -y binarycpython $PYTHON setup.py build --force $PYTHON setup.py sdist $PIP install -v dist/binarycpython-$VERSION_NUMBER.tar.gz