bmtool 0.6.6.4__tar.gz → 0.6.7__tar.gz

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.
Files changed (29) hide show
  1. {bmtool-0.6.6.4 → bmtool-0.6.7}/PKG-INFO +1 -1
  2. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/SLURM.py +69 -41
  3. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool.egg-info/PKG-INFO +1 -1
  4. {bmtool-0.6.6.4 → bmtool-0.6.7}/setup.py +1 -1
  5. {bmtool-0.6.6.4 → bmtool-0.6.7}/LICENSE +0 -0
  6. {bmtool-0.6.6.4 → bmtool-0.6.7}/README.md +0 -0
  7. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/__init__.py +0 -0
  8. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/__main__.py +0 -0
  9. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/bmplot.py +0 -0
  10. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/connectors.py +0 -0
  11. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/debug/__init__.py +0 -0
  12. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/debug/commands.py +0 -0
  13. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/debug/debug.py +0 -0
  14. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/graphs.py +0 -0
  15. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/manage.py +0 -0
  16. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/plot_commands.py +0 -0
  17. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/singlecell.py +0 -0
  18. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/synapses.py +0 -0
  19. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/util/__init__.py +0 -0
  20. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/util/commands.py +0 -0
  21. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/util/neuron/__init__.py +0 -0
  22. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/util/neuron/celltuner.py +0 -0
  23. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool/util/util.py +0 -0
  24. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool.egg-info/SOURCES.txt +0 -0
  25. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool.egg-info/dependency_links.txt +0 -0
  26. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool.egg-info/entry_points.txt +0 -0
  27. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool.egg-info/requires.txt +0 -0
  28. {bmtool-0.6.6.4 → bmtool-0.6.7}/bmtool.egg-info/top_level.txt +0 -0
  29. {bmtool-0.6.6.4 → bmtool-0.6.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bmtool
3
- Version: 0.6.6.4
3
+ Version: 0.6.7
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
@@ -4,6 +4,8 @@ import subprocess
4
4
  import json
5
5
  import requests
6
6
  import shutil
7
+ import time
8
+ import copy
7
9
 
8
10
 
9
11
  def check_job_status(job_id):
@@ -117,7 +119,7 @@ class multiSeedSweep(seedSweep):
117
119
  MultSeedSweeps are centered around some base JSON cell file. When that base JSON is updated, the other JSONs
118
120
  change according to their ratio with the base JSON.
119
121
  """
120
- def __init__(self, base_json_file_path, param_name, syn_dict_list=[], base_ratio=1):
122
+ def __init__(self, base_json_file_path, param_name, syn_dict, base_ratio=1):
121
123
  """
122
124
  Initializes the multipleSeedSweep instance.
123
125
 
@@ -128,7 +130,7 @@ class multiSeedSweep(seedSweep):
128
130
  base_ratio (float): The ratio between the other JSONs; usually the current value for the parameter.
129
131
  """
130
132
  super().__init__(base_json_file_path, param_name)
131
- self.syn_dict_list = syn_dict_list
133
+ self.syn_dict_for_multi = syn_dict
132
134
  self.base_ratio = base_ratio
133
135
 
134
136
  def edit_all_jsons(self, new_value):
@@ -140,19 +142,19 @@ class multiSeedSweep(seedSweep):
140
142
  """
141
143
  self.edit_json(new_value)
142
144
  base_ratio = self.base_ratio
143
- for syn_dict in self.syn_dict_list:
144
- json_file_path = syn_dict['json_file_path']
145
- new_ratio = syn_dict['ratio'] / base_ratio
146
-
147
- with open(json_file_path, 'r') as f:
148
- data = json.load(f)
149
- altered_value = new_ratio * new_value
150
- data[self.param_name] = altered_value
151
-
152
- with open(json_file_path, 'w') as f:
153
- json.dump(data, f, indent=4)
145
+
146
+ json_file_path = self.syn_dict_for_multi['json_file_path']
147
+ new_ratio = self.syn_dict_for_multi['ratio'] / base_ratio
154
148
 
155
- print(f"JSON file '{json_file_path}' modified successfully with {self.param_name}={altered_value}.", flush=True)
149
+ with open(json_file_path, 'r') as f:
150
+ data = json.load(f)
151
+ altered_value = new_ratio * new_value
152
+ data[self.param_name] = altered_value
153
+
154
+ with open(json_file_path, 'w') as f:
155
+ json.dump(data, f, indent=4)
156
+
157
+ print(f"JSON file '{json_file_path}' modified successfully with {self.param_name}={altered_value}.", flush=True)
156
158
 
157
159
 
158
160
  class SimulationBlock:
@@ -273,6 +275,7 @@ export OUTPUT_DIR={case_output_dir}
273
275
  """
274
276
  for job_id in self.job_ids:
275
277
  status = check_job_status(job_id)
278
+ #print(f"status of job is {status}")
276
279
  if status != 'COMPLETED': # can add PENDING here for debugging NOT FOR ACTUALLY USING IT
277
280
  return False
278
281
  return True
@@ -314,7 +317,7 @@ class BlockRunner:
314
317
  """
315
318
 
316
319
  def __init__(self, blocks, json_editor=None,json_file_path=None, param_name=None,
317
- param_values=None, check_interval=60,syn_dict_list = None,
320
+ param_values=None, check_interval=60,syn_dict = None,
318
321
  webhook=None):
319
322
  self.blocks = blocks
320
323
  self.json_editor = json_editor
@@ -323,29 +326,46 @@ class BlockRunner:
323
326
  self.webhook = webhook
324
327
  self.param_name = param_name
325
328
  self.json_file_path = json_file_path
326
- self.syn_dict_list = syn_dict_list
329
+ self.syn_dict = syn_dict
327
330
 
328
331
  def submit_blocks_sequentially(self):
329
332
  """
330
333
  Submits all blocks sequentially, ensuring each block starts only after the previous block has completed or is running.
331
334
  Updates the JSON file with new parameters before each block run.
332
- json file path should be the path WITH the components folder
333
335
  """
334
336
  for i, block in enumerate(self.blocks):
335
337
  # Update JSON file with new parameter value
336
- if self.json_editor == None and self.param_values == None:
338
+ if self.json_file_path == None and self.param_values == None:
339
+ source_dir = block.component_path
340
+ destination_dir = f"{source_dir}{i+1}"
341
+ block.component_path = destination_dir
342
+ shutil.copytree(source_dir, destination_dir) # create new components folder
337
343
  print(f"skipping json editing for block {block.block_name}",flush=True)
338
344
  else:
339
345
  if len(self.blocks) != len(self.param_values):
340
346
  raise Exception("Number of blocks needs to each number of params given")
341
347
  new_value = self.param_values[i]
348
+ # hope this path is correct
349
+ source_dir = block.component_path
350
+ destination_dir = f"{source_dir}{i+1}"
351
+ block.component_path = destination_dir
352
+
353
+ shutil.copytree(source_dir, destination_dir) # create new components folder
354
+ json_file_path = os.path.join(destination_dir,self.json_file_path)
355
+
356
+ # need to keep the orignal around
357
+ syn_dict_temp = copy.deepcopy(self.syn_dict)
358
+ print(self.syn_dict['json_file_path'])
359
+ json_to_be_ratioed = syn_dict_temp['json_file_path']
360
+ corrected_ratio_path = os.path.join(destination_dir,json_to_be_ratioed)
361
+ syn_dict_temp['json_file_path'] = corrected_ratio_path
342
362
 
343
- if self.syn_dict_list == None:
344
- json_editor = seedSweep(self.json_file_path, self.param_name)
363
+ if self.syn_dict == None:
364
+ json_editor = seedSweep(json_file_path , self.param_name)
345
365
  json_editor.edit_json(new_value)
346
366
  else:
347
- json_editor = multiSeedSweep(self.json_file_path,self.param_name,
348
- self.syn_dict_list,base_ratio=1)
367
+ json_editor = multiSeedSweep(json_file_path ,self.param_name,
368
+ syn_dict=syn_dict_temp,base_ratio=1)
349
369
  json_editor.edit_all_jsons(new_value)
350
370
 
351
371
  # Submit the block
@@ -357,7 +377,7 @@ class BlockRunner:
357
377
 
358
378
  # Wait for the block to complete
359
379
  if i == len(self.blocks) - 1:
360
- while not block.check_block_completed():
380
+ while not block.check_block_status():
361
381
  print(f"Waiting for the last block {i} to complete...")
362
382
  time.sleep(self.check_interval)
363
383
  else: # Not the last block so if job is running lets start a new one (checks status list)
@@ -376,13 +396,14 @@ class BlockRunner:
376
396
  submits all the blocks at once onto the queue. To do this the components dir will be cloned and each block will have its own.
377
397
  Also the json_file_path should be the path after the components dir
378
398
  """
379
- if self.webhook:
380
- message = "SIMULATION UPDATE: Simulations have been submited in parallel!"
381
- send_teams_message(self.webhook,message)
382
- if self.param_values == None:
383
- print(f"skipping json editing for block {block.block_name}",flush=True)
384
- else:
385
- for i, block in enumerate(self.blocks):
399
+ for i, block in enumerate(self.blocks):
400
+ if self.param_values == None:
401
+ source_dir = block.component_path
402
+ destination_dir = f"{source_dir}{i+1}"
403
+ block.component_path = destination_dir
404
+ shutil.copytree(source_dir, destination_dir) # create new components folder
405
+ print(f"skipping json editing for block {block.block_name}",flush=True)
406
+ else:
386
407
  if block.component_path == None:
387
408
  raise Exception("Unable to use parallel submitter without defining the component path")
388
409
  new_value = self.param_values[i]
@@ -393,22 +414,29 @@ class BlockRunner:
393
414
 
394
415
  shutil.copytree(source_dir, destination_dir) # create new components folder
395
416
  json_file_path = os.path.join(destination_dir,self.json_file_path)
396
- if self.syn_dict_list == None:
397
- json_editor = seedSweep(json_file_path, self.param_name)
417
+
418
+ # need to keep the orignal around
419
+ syn_dict_temp = copy.deepcopy(self.syn_dict)
420
+ print(self.syn_dict['json_file_path'])
421
+ json_to_be_ratioed = syn_dict_temp['json_file_path']
422
+ corrected_ratio_path = os.path.join(destination_dir,json_to_be_ratioed)
423
+ syn_dict_temp['json_file_path'] = corrected_ratio_path
424
+
425
+ if self.syn_dict == None:
426
+ json_editor = seedSweep(json_file_path , self.param_name)
398
427
  json_editor.edit_json(new_value)
399
428
  else:
400
- json_editor = multiSeedSweep(json_file_path,self.param_name,
401
- self.syn_dict_list,base_ratio=1)
402
- json_editor.edit_all_jsons(new_value)
403
-
404
- # submit block with new component path
429
+ json_editor = multiSeedSweep(json_file_path ,self.param_name,
430
+ syn_dict_temp,base_ratio=1)
431
+ json_editor.edit_all_jsons(new_value)
432
+ # submit block with new component path
405
433
  print(f"Submitting block: {block.block_name}", flush=True)
406
434
  block.submit_block()
407
435
  if i == len(self.blocks) - 1:
408
- if self.webook:
409
- while not block.check_block_completed():
410
- print(f"Waiting for the last block {i} to complete...")
411
- time.sleep(self.check_interval)
436
+ print("\nEverything has been submitted. You can close out of this or keep this script running to get a message when everything is finished\n")
437
+ while not block.check_block_status():
438
+ print(f"Waiting for the last block {i} to complete...")
439
+ time.sleep(self.check_interval)
412
440
 
413
441
  if self.webhook:
414
442
  message = "SIMULATION UPDATE: Simulations are Done!"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bmtool
3
- Version: 0.6.6.4
3
+ Version: 0.6.7
4
4
  Summary: BMTool
5
5
  Home-page: https://github.com/cyneuro/bmtool
6
6
  Download-URL:
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
6
6
 
7
7
  setup(
8
8
  name="bmtool",
9
- version='0.6.6.4',
9
+ version='0.6.7',
10
10
  author="Neural Engineering Laboratory at the University of Missouri",
11
11
  author_email="gregglickert@mail.missouri.edu",
12
12
  description="BMTool",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes