Skip to content
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

Shielded libstempo dependencies if only pint installed #184

Merged
merged 3 commits into from
May 16, 2019

Conversation

Hazboun6
Copy link
Member

This is Pull Request to deal with Issue #183. I've changed the code in enterprise.Pulsar() so that libstempo is no longer required if user hasPINT installed.

@paulthebaker
Copy link
Member

While you're at it you could replace the list(filter( ...)) with list comprehensions. I think this is equivalent, but I haven't tested:

[isinstance(x, t2.tempopulsar) for x in args]

@Hazboun6
Copy link
Member Author

Hazboun6 commented May 16, 2019

I think what you have written will return a list of booleans, but the list(filter()) returns a list of objects.

@paulthebaker
Copy link
Member

paulthebaker commented May 16, 2019

Okay. To get a list of objects, you want:

[x for x in args if isinstance(x, t2.tempopulsar)]

I sort of tested it... This gives me a list of ints:

args = [0.0, 1, 2, 3.0, 4, 5.0]
[x for x in args if isinstance(x, int)]

I find list comprensions to be much more readable than map/filter/reduce statements.
For this case it doesn't matter, but lambda statement are usually way slower than other options.

@Hazboun6
Copy link
Member Author

As @paulthebaker suggested elsewhere, there are many instances of list(filter()) throughout the code. This may be taken up at a later time.

@Hazboun6 Hazboun6 merged commit 057a889 into nanograv:master May 16, 2019
@Hazboun6 Hazboun6 deleted the jsh-t2-dependency branch May 16, 2019 18:41
@Hazboun6 Hazboun6 restored the jsh-t2-dependency branch May 16, 2019 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants