Skip to content

Commit

Permalink
Merge pull request #1211 from Quantipy/i1210_rebased_sigtesting_skipped
Browse files Browse the repository at this point in the history
I1210 rebased sigtesting skipped
  • Loading branch information
alextanski authored Jan 15, 2019
2 parents 520e7a1 + e8f80df commit a4c715d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
7 changes: 4 additions & 3 deletions quantipy/core/quantify/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def __init__(self, link, weight=None, base_all=False, ignore_flags=False):
self.result = None
self.logical_conditions = []
self.cbase = self.rbase = None
self.rebased = {}
self.comb_x = self.comb_y = None
self.calc_x = self.calc_y = None
self._has_x_margin = self._has_y_margin = False
Expand Down Expand Up @@ -1564,8 +1563,6 @@ def normalize(self, on='y', per_cell=False):
"""
Convert a raw cell count result to its percentage representation.
.. note:: Will prioritize the self.rebased margin row if one is found.
Parameters
----------
on : {'y', 'x', 'counts_sum', str}, default 'y'
Expand Down Expand Up @@ -1686,6 +1683,7 @@ def __init__(self, link, view_name_notation, test_total=False):
self.Quantity.swap(var=view.has_other_source())
cond = {orgx: not_count(0)}
self.Quantity.filter(cond, keep_base=False, inplace=True)
self.rebased = view._kwargs.get('rebased', False)
self._set_baseline_aggregates(view)
# Set information about the incoming aggregation
# to be able to route correctly through the algorithms
Expand Down Expand Up @@ -1838,6 +1836,9 @@ def set_params(self, test_total=False, level='mid', mimic='Dim', testtype='poole
self.no_diffs = True
if self.y == '@':
self.no_pairs = True
if self.rebased:
self.invalid = True
self.no_pairs = True
if self.invalid:
self.mimic = mimic
self.comparevalue, self.level = self._convert_level(level)
Expand Down
4 changes: 4 additions & 0 deletions quantipy/core/view_generators/view_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ def frequency(self, link, name, kwargs):
per_cell = True
elif rel_to_kind[1] == 'y':
per_cell = False
try:
link['x|f|:||{}|counts'.format(weights)]._kwargs['rebased'] = True
except:
pass
# ====================================================================
w = weights if weights is not None else None
ignore = True if name == 'cbase_gross' else False
Expand Down
13 changes: 9 additions & 4 deletions quantipy/sandbox/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ def _updated_index_tuples(self, axis):
if (self.array_mi and axis == 1) or axis == 0:
self._transf_views = self._insert_viewlikes(merged, mapped)
else:
self._transf_views = self._org_views
self._transf_views = self.org_views
# ================================================================
i = d = 0
new_tuples = []
Expand All @@ -1857,10 +1857,10 @@ def _reindex(self):
x_names = y_names
else:
x_names = ['Array', 'Questions']
tuples = self._updated_index_tuples(axis=0)
self.df.index = pd.MultiIndex.from_tuples(tuples, names=x_names)
tuples = self._updated_index_tuples(axis=1)
self.df.columns = pd.MultiIndex.from_tuples(tuples, names=y_names)
tuples = self._updated_index_tuples(axis=0)
self.df.index = pd.MultiIndex.from_tuples(tuples, names=x_names)
return None

def export(self):
Expand Down Expand Up @@ -2307,7 +2307,12 @@ def _views_per_rows(self):
def _valid_views(self, flat=False):
clean_view_list = []
valid = self.views.keys()
for v in self._given_views:
org_vc = self._given_views
v_likes = [v for v in valid if v.startswith('__viewlike__')]
if isinstance(org_vc, tuple):
v_likes = tuple(v_likes)
view_coll = org_vc + v_likes
for v in view_coll:
if isinstance(v, (str, unicode)):
if v in valid:
clean_view_list.append(v)
Expand Down

0 comments on commit a4c715d

Please sign in to comment.