Skip to content

Commit

Permalink
Merge branch 'master' of github.com:oscarbranson/latools
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarbranson committed Mar 11, 2024
2 parents 6b4308e + a9cd0de commit 57cd0c7
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 116 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
# Changelog
All significant changes to the software will be documented here.

## [0.3.27-dev] - LIVE
## [0.3.30-dev] - LIVE

### TODO
- implement different analyte lists for different stages (raw, ratios, mass_fractions), OR improve analyte_checker functionality. This has to propagate throught to filter assignment.

## [0.3.30] - 12/01/2024

### Changed
- Changed `sklearn` to `scikit-learn` in requirements.txt to accommodate change in upstream package name
- Moved from setup.py to setup.cfg for package metadata
- Changed version labelling from `__version__` to `VERSION` to match pypi expectations.


## [0.3.29]

More pandas 2.0 'indexing with set' compatibility updates...

### Changed
- modify dataframe indexing in filt_obj to work with pandas>=2.0.0



## [0.3.28]

### Changed
- minor updates to work with pandas>=2.0.0
- plotting updates to use `.get_subplotspec()` when checking row/col status.
- minor revisions to GitHub Actions scripts


## [0.3.27] missed... oops!

## [0.3.26]

### Changed
Expand Down
16 changes: 8 additions & 8 deletions Supplement/comparison_tools/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ def comparison_plots(df, els=['Mg', 'Sr', 'Ba', 'Al', 'Mn']):
ax.plot(xlim, xlim, c='k', ls='dashed', alpha=0.6)

for ax in axs[i]:
if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
hax.set_xlabel('Residual')
tax.set_xlabel('Reference User')
lax.set_xlabel('Reference User')
hax.legend(fontsize=8)

if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
tax.set_title('Manual Test User', loc='left')
lax.set_title('LAtools Test User', loc='left')

Expand Down Expand Up @@ -232,15 +232,15 @@ def residual_plots(df, rep_stats=None, els=['Mg', 'Sr', 'Ba', 'Al', 'Mn']):
if rep_stats is not None:
ax.axhspan(-rep_stats[e][0] * 2, rep_stats[e][0] * 2, color=(0,0,0,0.2), zorder=-1)

if not ax.is_first_col():
if not ax.get_subplotspec().is_first_col():
ax.set_yticklabels([])

if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
hax.set_xlabel('Density')
tax.set_xlabel('Reference User')
lax.set_xlabel('Reference User')

if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
tax.set_title('Manual Test User', loc='left')
lax.set_title('LAtools Test User', loc='left')

Expand Down Expand Up @@ -374,21 +374,21 @@ def bland_altman_plots(df, rep_stats=None, els=['Mg', 'Sr', 'Ba', 'Al', 'Mn']):
for ax in axs[i]:
ax.set_ylim(ylim)

if ax.is_first_col():
if ax.get_subplotspec().is_first_col():
ax.set_ylabel(e + ' ('+ u + ')\nResidual')
else:
ax.set_ylabel('')
ax.set_yticklabels([])

if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
tax.set_xlabel('Mean')
lax.set_xlabel('Mean')
hax.set_xlabel('Residual Density')
hax.legend()
else:
ax.set_xlabel('')

if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
tax.set_title('Manual Test User', loc='left')
lax.set_title('LAtools Test User', loc='left')
hax.set_title('Residuals', loc='left')
Expand Down
10 changes: 5 additions & 5 deletions Supplement/comparison_tools/plots_1sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def comparison_plots(df, els=['Mg', 'Sr', 'Al', 'Mn', 'Fe', 'Cu', 'Zn', 'B']):
lax.plot(xlim, xlim, c='k', ls='dashed', alpha=0.6)

for ax in axs[i]:
if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
hax.set_xlabel('Residual')
lax.set_xlabel('Iolite User')
hax.legend(fontsize=8)

if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
lax.set_title('LAtools', loc='left')

fig.tight_layout()
Expand Down Expand Up @@ -164,14 +164,14 @@ def residual_plots(df, rep_stats=None, els=['Mg', 'Sr', 'Al', 'Mn', 'Fe', 'Cu',
if rep_stats is not None:
ax.axhspan(-rep_stats[e][0] * 2, rep_stats[e][0] * 2, color=(0,0,0,0.2), zorder=-1)

if not ax.is_first_col():
if not ax.get_subplotspec().is_first_col():
ax.set_yticklabels([])

if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
hax.set_xlabel('Density')
lax.set_xlabel('Iolite User')

if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
lax.set_title('LAtools', loc='left')

fig.tight_layout()
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
# built documents.
#
# The short X.Y version.
version = latools.__version__
version = latools.VERSION
# The full version, including alpha/beta/rc tags.
release = latools.__version__
release = latools.VERSION

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
16 changes: 8 additions & 8 deletions latools/D_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,13 +1550,13 @@ def crossplot(self, analytes=None, bins=25, lognorm=True, filt=True, colourful=T
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)

if ax.is_first_col():
if ax.get_subplotspec().is_first_col():
ax.yaxis.set_ticks_position('left')
if ax.is_last_col():
if ax.get_subplotspec().is_last_col():
ax.yaxis.set_ticks_position('right')
if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
ax.xaxis.set_ticks_position('top')
if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
ax.xaxis.set_ticks_position('bottom')

# set up colour scales
Expand Down Expand Up @@ -1664,13 +1664,13 @@ def crossplot_filters(self, filter_string, analytes=None):
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)

if ax.is_first_col():
if ax.get_subplotspec().is_first_col():
ax.yaxis.set_ticks_position('left')
if ax.is_last_col():
if ax.get_subplotspec().is_last_col():
ax.yaxis.set_ticks_position('right')
if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
ax.xaxis.set_ticks_position('top')
if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
ax.xaxis.set_ticks_position('bottom')

# isolate nominal_values for all analytes
Expand Down
2 changes: 1 addition & 1 deletion latools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .helpers import chemistry
from . import preprocessing

__version__ = '0.3.26'
VERSION = '0.3.30'

def cite(output='text'):
"""
Expand Down
6 changes: 3 additions & 3 deletions latools/filtering/filt_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def check_analytes(self, analytes=None, single=False, allow_multiples=False):
return analytes[0]
return valid.pop()
else:
return valid
return list(valid)

def add(self, name, filt, info='', params=(), setn=None):
"""
Expand Down Expand Up @@ -286,9 +286,9 @@ def make_analyte(self, analyte):
boolean filter
"""
analyte = self.check_analytes(analyte)

key = []
for n, f in self.filter_table[analyte].index[self.filter_table[analyte].any(1)]:
for n, f in self.filter_table[analyte].index[self.filter_table[analyte].any(axis=1)]:
key.append(f'{n}:{f}')

return self.make_fromkey('&'.join(key))
Expand Down
16 changes: 8 additions & 8 deletions latools/helpers/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ def crossplot(dat, keys=None, lognorm=True, bins=25, figsize=(12, 12),
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)

if ax.is_first_col():
if ax.get_subplotspec().is_first_col():
ax.yaxis.set_ticks_position('left')
if ax.is_last_col():
if ax.get_subplotspec().is_last_col():
ax.yaxis.set_ticks_position('right')
if ax.is_first_row():
if ax.get_subplotspec().is_first_row():
ax.xaxis.set_ticks_position('top')
if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
ax.xaxis.set_ticks_position('bottom')

# set up colour scales
Expand Down Expand Up @@ -473,7 +473,7 @@ def histograms(dat, keys=None, bins=25, logy=False, cmap=None, ncol=4):

ax.set_ylim(1, ax.get_ylim()[1])

if ax.is_first_col():
if ax.get_subplotspec().is_first_col():
ax.set_ylabel(ylab)

ax.set_yticklabels([])
Expand Down Expand Up @@ -701,11 +701,11 @@ def autorange_plot(t, sig, gwin=7, swin=None, win=30,
ax.text(.95, .95, '{} (off)'.format(n), ha='right',
va='top', transform=ax.transAxes)

if ax.is_last_row():
if ax.get_subplotspec().is_last_row():
ax.set_xlabel('Time (s)')
if ax.is_first_col():
if ax.get_subplotspec().is_first_col():
ax.set_ylabel('Gradient (x)')
if ax.is_last_col():
if ax.get_subplotspec().is_last_col():
tax.set_ylabel('Signal (line)')

if fail:
Expand Down
Loading

0 comments on commit 57cd0c7

Please sign in to comment.