MilesCranmer commited on
Commit
9a46c88
1 Parent(s): 05cff8a

Fix potential bug with user equation filename in temp dir

Browse files
Files changed (1) hide show
  1. pysr/sr.py +5 -6
pysr/sr.py CHANGED
@@ -281,12 +281,11 @@ def pysr(X=None, y=None, weights=None,
281
 
282
  kwargs = {**_set_paths(tempdir), **kwargs}
283
 
284
- if equation_file is None:
285
- if temp_equation_file:
286
- equation_file = kwargs['tmpdir'] / f'hall_of_fame.csv'
287
- else:
288
- date_time = datetime.now().strftime("%Y-%m-%d_%H%M%S.%f")[:-3]
289
- equation_file = 'hall_of_fame_' + date_time + '.csv'
290
 
291
  kwargs = {**dict(equation_file=equation_file), **kwargs}
292
 
 
281
 
282
  kwargs = {**_set_paths(tempdir), **kwargs}
283
 
284
+ if temp_equation_file:
285
+ equation_file = kwargs['tmpdir'] / f'hall_of_fame.csv'
286
+ elif equation_file is None:
287
+ date_time = datetime.now().strftime("%Y-%m-%d_%H%M%S.%f")[:-3]
288
+ equation_file = 'hall_of_fame_' + date_time + '.csv'
 
289
 
290
  kwargs = {**dict(equation_file=equation_file), **kwargs}
291