-
Notifications
You must be signed in to change notification settings - Fork 6
Patching parsing issues with approval #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,11 +43,15 @@ def main(arguments): | |
| try: | ||
| command(arguments[2:]) | ||
| except BaseException as err: | ||
| print() | ||
| print('Running pippi failed in '+command.__name__+' operation, due to error:') | ||
| print(err) | ||
| print() | ||
| sys.exit() | ||
| clean_exit = False | ||
| if isinstance(err, SystemExit): | ||
| clean_exit = True if err.code == 0 else clean_exit | ||
|
Comment on lines
+46
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find this construction kind of convoluted and therefore a bit difficult to follow. How about something like just clean_exit = isinstance(err, SystemExit) and err.code == 0? |
||
| if not clean_exit: | ||
| print() | ||
| print('Running pippi failed in '+command.__name__+' operation, due to error:') | ||
| print(err) | ||
| print() | ||
| sys.exit() | ||
| if not command in [merge, pare]: | ||
| print() | ||
| print('Completed sucessfully.') | ||
|
|
@@ -61,11 +65,15 @@ def main(arguments): | |
| try: | ||
| command(arguments[1:]) | ||
| except BaseException as err: | ||
| print() | ||
| print('Running pippi failed in '+command.__name__+' operation.') | ||
| print(err) | ||
| print() | ||
| sys.exit() | ||
| clean_exit = False | ||
| if isinstance(err, SystemExit): | ||
| clean_exit = True if err.code == 0 else clean_exit | ||
|
Comment on lines
+68
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment |
||
| if not clean_exit: | ||
| print() | ||
| print('Running pippi failed in '+command.__name__+' operation.') | ||
| print(err) | ||
| print() | ||
| sys.exit() | ||
| print() | ||
| print('Completed sucessfully.') | ||
| print() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -278,7 +278,7 @@ def getChainData(filename, cut_all_invalid=None, requested_cols=None, assignment | |
| for i, column_name in enumerate(column_names): | ||
| if column_name != '': print(" ", i, ":", column_name) | ||
| print() | ||
| quit() | ||
| sys.exit(0) | ||
|
|
||
| # Identify any likelihood or multiplicity indicated by the labels. | ||
| if labels: | ||
|
|
@@ -313,7 +313,7 @@ def getChainData(filename, cut_all_invalid=None, requested_cols=None, assignment | |
| data_isvalid.append(np.array(entries[column_names[index]+"_isvalid"], dtype=np.float64)) | ||
| lookup_key[index] = index_count | ||
| index_count += 1 | ||
| non_functional_cols = [i for i, elem in enumerate(data) if data[i] != 'functional'] | ||
| non_functional_cols = [i for i, elem in enumerate(data) if np.all(data[i] != 'functional')] # Numpy now requires the user cast to a scalar when performing boolean checks on arrays | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems confusing, or at least not the optimal way to check. What's being checked for here is just whether |
||
| if not non_functional_cols: | ||
| print("ERROR: At least one non-function assignment is needed in") | ||
| print("assign_to_pippi_datastream, or a multiplicity or likelihood") | ||
|
|
@@ -325,13 +325,13 @@ def getChainData(filename, cut_all_invalid=None, requested_cols=None, assignment | |
| # Fill in the functional columns with zeros. Note that this uses more memory than doing it after validity | ||
| # cuts, but should actually be faster (I think; haven't actually tested that). It makes the code simpler too. | ||
| for i, elem in enumerate(data): | ||
| if elem == 'functional': | ||
| if np.any(elem == 'functional'): # Numpy cast to a scalar boolean check | ||
| data[i] = np.zeros(total_samples, dtype=np.float64) | ||
| else: | ||
| # Do some pruning to deal with cases where the some datasets have extra entries (although this arguably indicates a bug in the sampler) | ||
| data[i] = elem[:total_samples] | ||
| for i, elem in enumerate(data_isvalid): | ||
| if elem == 'functional': | ||
| if np.any(elem == 'functional'): # Numpy cast to a scalar boolean check | ||
| data_isvalid[i] = np.ones(total_samples, dtype=np.float64) | ||
| else: | ||
| # Do some pruning to deal with cases where the some datasets have extra entries (although this arguably indicates a bug in the sampler) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the use of packaging for versioning break compatibility with Python 2.7? If so, we should just remove 2.7 here, there's no real need to support it any longer.