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

issue 14: Multi dims horizontal labels #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alixdamman
Copy link
Contributor

First attempt to implement multiple horizontal dimensions.
Need further discussion and tests.

Not sure what to do with:

  • reset of number of hor. dims (currently, it is reset to 1 when filters are reset)
  • copy to excel (reproduce exactly what you see in viewer)
  • plot

@alixdamman alixdamman requested a review from gdementen September 7, 2017 15:31
@gdementen
Copy link
Collaborator

I didn't think this was on the roadmap for 0.26... There is already much on our plate. I reckon we did not discuss this, but for the next release I think we should discuss together the features to work on and stick to them.

Not sure what to do with:
reset of number of hor. dims (currently, it is reset to 1 when filters are reset)

Seems sensible. Should only reset when going from one array to another, like for filters.

copy to excel (reproduce exactly what you see in viewer)

Reproducing what you see seems sensible.

plot

Unsure. My guess is that plotting "what you see" would be best. I.e. considering all columns dimensions as being the x axis.

@alixdamman
Copy link
Contributor Author

alixdamman commented Sep 8, 2017

Well, I started to work on that weeks ago so it took me only few hours yesterday to have something that doesn't crash at first side.

Concerning copy to excel, what bother me is that exported array cannot be reload using read_excel or even Workbook.

It's totally OK if this PR is not included in version 0.26. I just think that including this feature with the use of buffer to load data in the same release would be quite dangerous.

Anyway, this PR will need a kind of "monkey test".

@gdementen
Copy link
Collaborator

Well, I started to work on that weeks ago so it took me only few hours yesterday to have something that doesn't crash at first side.

Ok, sorry. I did not realize this. I still think it would be a good idea to discuss what to include in the new releases when starting a new cycle.

Concerning copy to excel, what bother me is that exported array cannot be reload using read_excel or even Workbook.

That should be fixed there and could be done later.

It's totally OK if this PR is not included in version 0.26. I just think that including this feature with the use of buffer to load data in the same release would be quite dangerous.

Anyway, this PR will need a kind of "monkey test".

Ok, I will try to be your monkey :)

@alixdamman
Copy link
Contributor Author

Jehan also proposed to play the monkey (before a release).

Copy link
Collaborator

@gdementen gdementen left a comment

Choose a reason for hiding this comment

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

unsure I like the {xy}label -> {hv}label change. Either is fine by me, but here matplotlib use xlabels so in the end we end up using both xlabels and hlabels which is kinda confusing IMO.

@alixdamman
Copy link
Contributor Author

alixdamman commented Sep 8, 2017

But QTable use horizontal and vertical headers. IMO xlabels and ylabels are for a 2D plot, not for a table. I actually found using x/ylabels in QTable models and views quite confusing when I started to work on the viewer.

@gdementen
Copy link
Collaborator

Ok, makes sense.

@alixdamman alixdamman force-pushed the multi_dims_xlabels_14 branch 3 times, most recently from c6b4a23 to c2c5072 Compare September 27, 2017 10:18
@alixdamman alixdamman force-pushed the multi_dims_xlabels_14 branch from c2c5072 to 078dd32 Compare October 11, 2017 07:34
@alixdamman alixdamman added this to the 0.27 milestone Oct 13, 2017
@alixdamman alixdamman force-pushed the multi_dims_xlabels_14 branch from 078dd32 to 9635f14 Compare October 13, 2017 14:13
@alixdamman alixdamman force-pushed the multi_dims_xlabels_14 branch 3 times, most recently from fdf8fe9 to dcd6f13 Compare October 20, 2017 09:37
@alixdamman alixdamman removed this from the 0.27 milestone Oct 20, 2017
@alixdamman
Copy link
Contributor Author

Not urgent but I would like to finish and merge this PR before to start to work on issue larray-project/larray#411

@alixdamman
Copy link
Contributor Author

Note: I'm not sure what to do with methods copy and paste of ArrayEditorWidget.

prod = Product(axes.labels)
return [_LazyDimLabels(prod, i) for i in range(len(axes.labels))]
vlabels = get_labels_product(axes[:nb_dims_vlabels])
hlabels = get_labels_product(axes[nb_dims_vlabels:], nb_dims_vlabels > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems odd. I would have thought vlabels would get the extra/fake axis instead of hlabels and that the condition would be nb_dims_vlabels == 0, not nb_dims_vlabels > 0???

@@ -810,6 +820,9 @@ def _update_digits_scientific(self, data):

self.gradient_chooser.setEnabled(self.model_data.bgcolor_possible)

self.nb_horizontal_dims_spinbox.setMinimum(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

move this out of the function (to set_data)

# # ndim == 1
# list_data = [list_data[1][1:]]
# new_data = np.array(list_data)
if self._raw_data_selection is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ouch. This is no good. This prevents copy/paste from other applications!

@@ -125,7 +125,8 @@ class LabelsArrayModel(AbstractArrayModel):
font : QFont, optional
Font. Default is `Calibri` with size 11.
"""
def __init__(self, parent=None, data=None, readonly=False, font=None):
def __init__(self, parent=None, data=None, readonly=False, font=None, orientation=Qt.Horizontal):
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it turns out to be indeed necessary to differentiate on the orientation (I am unsure about this), then having two different subclasses of LabelsArrayModel depending on the orientation would make things cleaner.

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