jsongrapher 3.7__py3-none-any.whl → 3.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ import JSONGrapher.styles.trace_styles_collection_library
8
8
  global_records_list = [] #This list holds onto records as they are added. Index 0 is the merged record. Each other index corresponds to record number (like 1 is first record, 2 is second record, etc)
9
9
 
10
10
 
11
+
11
12
  #This is a JSONGrapher specific function
12
13
  #That takes filenames and adds new JSONGrapher records to a global_records_list
13
14
  #If the all_selected_file_paths and newest_file_name_and_path are [] and [], that means to clear the global_records_list.
@@ -3118,6 +3119,8 @@ def clean_json_fig_dict(json_fig_dict, fields_to_update=None):
3118
3119
 
3119
3120
  ### Beginning of section of file that has functions for "simulate" and "equation" fields, to evaluate equations and call external javascript simulators, as well as support functions ###
3120
3121
 
3122
+ local_python_functions_dictionary = {} #This is a global variable that works with the "simulate" feature and lets users call python functions for data generation.
3123
+
3121
3124
  def run_js_simulation(javascript_simulator_url, simulator_input_json_dict, verbose = False):
3122
3125
  """
3123
3126
  Downloads a JavaScript file using its URL, extracts the filename, appends an export statement,
@@ -3227,7 +3230,7 @@ def convert_to_raw_github_url(url):
3227
3230
  return url # Return unchanged if not a GitHub file URL
3228
3231
 
3229
3232
  #This function takes in a data_series_dict object and then
3230
- #calls an external javascript simulation if needed
3233
+ #calls an external python or javascript simulation if needed
3231
3234
  #Then fills the data_series dict with the simulated data.
3232
3235
  #This function is not intended to be called by the regular user
3233
3236
  #because it returns extra fields that need to be parsed out.
@@ -3235,6 +3238,16 @@ def convert_to_raw_github_url(url):
3235
3238
  def simulate_data_series(data_series_dict, simulator_link='', verbose=False):
3236
3239
  if simulator_link == '':
3237
3240
  simulator_link = data_series_dict["simulate"]["model"]
3241
+ if simulator_link == "local_python": #this is the local python case.
3242
+ #Here, I haev split up the lines of code more than needed so that the logic is easy to follow.
3243
+ simulation_function_label = data_series_dict["simulate"]["simulation_function_label"]
3244
+ simulation_function = local_python_functions_dictionary[simulation_function_label]
3245
+ simulation_return = simulation_function(data_series_dict)
3246
+ if "data" in simulation_return: #the simulation return should have the data_series_dict in another dictionary.
3247
+ simulation_result = simulation_return["data"]
3248
+ else: #if there is no "data" field, we will assume that only the data_series_dict has been returned.
3249
+ simulation_result = simulation_return
3250
+ return simulation_result
3238
3251
  try:
3239
3252
  simulation_return = run_js_simulation(simulator_link, data_series_dict, verbose=verbose)
3240
3253
  if isinstance(simulation_return, dict) and "error" in simulation_return: # Check for errors in the returned data
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jsongrapher
3
- Version: 3.7
3
+ Version: 3.8
4
4
  Summary: The python version of JSONGrapher with tools for creating JSONGrapher Records.
5
5
  Home-page: https://github.com/AdityaSavara/jsongrapher-py
6
6
  Author: Aditya Savara
7
7
  Author-email: AditySavara2008@u.northwestern.edu
8
- License: Unlicense
8
+ License: BSD-3-Clause
9
9
  Classifier: License :: OSI Approved :: BSD License
10
10
  Classifier: Programming Language :: Python
11
11
  Classifier: Programming Language :: Python :: 3
@@ -1,4 +1,4 @@
1
- JSONGrapher/JSONRecordCreator.py,sha256=bRyQPYr2TJZEtjMUF-idDO6mfRm3Rp_775iangiuRf8,204822
1
+ JSONGrapher/JSONRecordCreator.py,sha256=SFIYYNDpsUAx6vYA-I2ZGxNw7a1yA3yoIEE6oZtZWfc,205808
2
2
  JSONGrapher/UnitPytesting.py,sha256=xizJ-2fg9C5oNMFJyfavbBLMusayE9KWQiYIRrQQd4A,4363
3
3
  JSONGrapher/UnitpyCustomUnitsTesting.py,sha256=Rwq5p8HXN0FP54lRFgLTV0kgJ9TpcFaD3_C0MEOoEzw,1297
4
4
  JSONGrapher/__init__.py,sha256=cc5qXQidP_ABPXdnXy_DTdgPanHuR7ya45LV-BdWVh8,277
@@ -9,10 +9,10 @@ JSONGrapher/units_list.py,sha256=ROrlAsD66oPozZmOaE65xjNUEg3CxkSmA8iPE2_ihYI,344
9
9
  JSONGrapher/styles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  JSONGrapher/styles/layout_styles_library.py,sha256=vGb1tE_ETY-Blj2frt8ddHA976ADFSCoabjzKn2ZNYU,3051
11
11
  JSONGrapher/styles/trace_styles_collection_library.py,sha256=DUbbO8jTlhn2q-lOY1XYGkHV1RbJX-P5Z1SUCM0qo6M,5952
12
- jsongrapher-3.7.data/data/LICENSE,sha256=MroL1bQKoAHrMJv2KvABMmZX5j-DZ2EP_zaQacLUtj0,1465
13
- jsongrapher-3.7.data/data/README.md,sha256=OntfAICB_uwfjoq8tMDYc_W7eXSC2N22X0udPIGb2Nw,5888
14
- jsongrapher-3.7.dist-info/LICENSE,sha256=MroL1bQKoAHrMJv2KvABMmZX5j-DZ2EP_zaQacLUtj0,1465
15
- jsongrapher-3.7.dist-info/METADATA,sha256=1gml4jeoRaUaS8IMQfHaftk8Q0hXTLnsUM7dGi_9qfM,6956
16
- jsongrapher-3.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
17
- jsongrapher-3.7.dist-info/top_level.txt,sha256=5f7Ui2hCKCPTQOjD540WKghKNYOvUDNfdpnDbIlAD3Y,12
18
- jsongrapher-3.7.dist-info/RECORD,,
12
+ jsongrapher-3.8.data/data/LICENSE,sha256=MroL1bQKoAHrMJv2KvABMmZX5j-DZ2EP_zaQacLUtj0,1465
13
+ jsongrapher-3.8.data/data/README.md,sha256=OntfAICB_uwfjoq8tMDYc_W7eXSC2N22X0udPIGb2Nw,5888
14
+ jsongrapher-3.8.dist-info/LICENSE,sha256=MroL1bQKoAHrMJv2KvABMmZX5j-DZ2EP_zaQacLUtj0,1465
15
+ jsongrapher-3.8.dist-info/METADATA,sha256=IZYNGMd9jbDyWIoyqhW1oUan16p04jf228OW4h7wMrk,6959
16
+ jsongrapher-3.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
17
+ jsongrapher-3.8.dist-info/top_level.txt,sha256=5f7Ui2hCKCPTQOjD540WKghKNYOvUDNfdpnDbIlAD3Y,12
18
+ jsongrapher-3.8.dist-info/RECORD,,