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

0.2.3 -> 0.3.0 shims #153

Merged
merged 7 commits into from May 13, 2017
Merged

0.2.3 -> 0.3.0 shims #153

merged 7 commits into from May 13, 2017

Conversation

bmcfee
Copy link
Contributor

@bmcfee bmcfee commented May 13, 2017

This PR adds deprecation warnings and some forward-looking compatibility for #149 .

Implements #152.

times = timedelta_to_float(self.data.time.values)
duration = timedelta_to_float(self.data.duration.values)

return np.vstack([times, times + duration]).T, list(self.data.value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why np.vstack over np.array..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to concatenate them along the second axis; historical style holdover from the days before arbitary concat support.

but this is getting wiped in #149 also.

@@ -104,8 +104,8 @@ def beat(ref, est, **kwargs):
namespace = 'beat'
ref = coerce_annotation(ref, namespace)
est = coerce_annotation(est, namespace)
ref_interval, _ = ref.data.to_interval_values()
est_interval, _ = est.data.to_interval_values()
ref_interval, _ = ref.to_interval_values()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohgeez this is so much cleaner.

intervals, values = jf.to_interval_values()
assert len(out) > 0
assert out[0].category is DeprecationWarning
assert 'deprecated' in str(out[0].message).lower()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

return np.vstack([times, times + duration]).T, list(self.data.value)

def __iter_obs__(self):
for _, (t, d, v, c) in self.data.iterrows():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it odd that iterating self is (or will be) a shortcut to self.data.obs ... which feels like two unnecessary levels of abstraction? right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.data.obs is now (will be) self.data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but that's neither here nor there. The point of this change is to add forward support for:

for obs in annotation:
   # process jams.Observation object

the under-the-hood parts of how that iterator works won't matter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I meant that self -> Annotation, self.data -> AnnotationData, self.data.obs -> SortedListWithKey, and so only the last contains the items yielded by the iterator.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, i realize I forgot to contextualize my comment -- this change is fine; however, it occurs to me that the data structure is maybe deeper than necessary? not necessarily for iteration, but mutating it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right -- check the changes I made to #149 last night / this morning. That's all cleaned up now (and either way, irrelevant to this PR).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, i see now that my understanding of things elsewhere is stale.

@bmcfee bmcfee changed the title [WIP] 0.2.3 -> 0.3.0 shims 0.2.3 -> 0.3.0 shims May 13, 2017
@bmcfee
Copy link
Contributor Author

bmcfee commented May 13, 2017

Aside from deprecation of to_interval_values and adding the Observation type and annotation iterator, is there anything else that we can do here to make the transition easier?

@bmcfee
Copy link
Contributor Author

bmcfee commented May 13, 2017

.. I'm inclined to think there isn't much else we can do here, since any other deprecation warnings would apply to methods called internally as well as the public.

Unless there are objections from @ejhumphrey , I think this is ready to merge and push as 0.2.3 release.

@ejhumphrey
Copy link
Collaborator

i have no other thoughts or opinions at the moment, tho I apologize in advance for when they occur to me in 4 days.

@bmcfee bmcfee merged commit 04cbd3b into master May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants