Skip to content

Commit

Permalink
Documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardotlc committed Nov 15, 2023
1 parent 2a055c8 commit 29b7dd0
Show file tree
Hide file tree
Showing 27 changed files with 1,357 additions and 153 deletions.
Binary file modified database_analysis/__pycache__/dban_functions.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file modified database_analysis/__pycache__/dban_functions.cpython-311.pyc
Binary file not shown.
13 changes: 7 additions & 6 deletions database_analysis/dban_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def scopusfetcher(keyword, year_1, year_2, save_path):
"february",
"march",
"april",
"may",
"june",
"july",
"august",
Expand Down Expand Up @@ -455,20 +456,20 @@ def bar_plot_df(df, save_path, title):
"""
fig, ax = plt.subplots(dpi=100)
plt.xlabel("Year", fontsize=14)
plt.ylabel("Published Articles", fontsize=14)
plt.xlabel("Year", fontsize=16)
plt.ylabel("Published Articles", fontsize=16)
plt.xlim(df.Year.min() - 1, df.Year.max() + 1)
if title:
ax.set_title(title, fontsize=18)
ax.set_title(title, fontsize=21)
else:
title = 'Database'
ax.bar(df['Year'], df["sum"], label=df["sum"])
for index, value in enumerate(df['sum']):
plt.text(df['Year'][index], value + 0.15, str(value), ha='center',
va='bottom', fontsize=8)
va='bottom', fontsize=10)
plt.xticks(df.Year[df.index % 2 == 0], fontsize=10)
# ytickstmp = (np.arange(df['sum'].min, df['sum'].max, 6)
plt.yticks(fontsize=10)
plt.yticks(fontsize=12)
if save_path:
plt.savefig(f"{save_path}/{title}.png")
plt.show()
Expand Down Expand Up @@ -510,7 +511,7 @@ def fetch_springer(keyword, year_1, year_2, save_path):
...
...
2021: 4059
2022: 4723
2022: 4720
>>> print(springer_test)
Year Articles
0 2010 536
Expand Down
37 changes: 5 additions & 32 deletions docs/TODO.rst
Original file line number Diff line number Diff line change
@@ -1,51 +1,24 @@
====
TODO
====

Client
------

- Separate cli main function in smaller functions

- Check utils functions absolute_path and remove_duplicates (Might delete).

- Add spinger function

- add scopus function to the others db functions

- add db_stats, as well as any df stat

- add bar plot

Mass Spectrometry
-----------------
=================

- Make script to plot MS2

- See the possibillity of adding peaks that have difference lower than given resolution

Documentation
-------------

- Correct not found class error, from docstrings, like pd.DataFrame and matplotlib types
=============

- Add plots/nbs to the documentation

- Add springer function

Notebooks
---------
=========


Data analysis
-------------

- Check if kwargs type values are correct by testing

- Create an conditional if queryied articles in a month is more than 9999, to split
the month and than add the results.

- Check statistic function and find_matching_postions. (Might delete them)

- Probably remove read_pubmed_csv function (deprecated, use clean_csv instead)
=============

- Remove my springer api from the code, try to use as an environment variable
34 changes: 34 additions & 0 deletions docs/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,40 @@ To print the help from this module exec:
python cli.py -h
.. list-table:: Client
:widths: 25 25 60 20
:header-rows: 1

* - Flag
- Arguments
- Description
- Module
* - -h --help
- None
- Print clien module help
- General
* - -i --input
- str
- Input to another executed flag, like the path to a file
- General
* - -o --output
- str
- Output to another executed flag, like path to saved file
- General
* - -M --mplcfg
- None
- Configure matplotlib style to the developer default
- Matplotlib
* - -S --subtitle
- str
- Plot subtitle
- Matplotlib
* - -t --title
- str
- Plot title
- Matplotlib

|
|
|
Expand Down
132 changes: 79 additions & 53 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import shutil
import os
from textwrap import dedent
import matplotlib.sphinxext
import bokeh.sphinxext
sys.path.append(os.path.abspath('sphinxext'))
sys.path.append(os.path.abspath('static'))
sys.path.append(os.path.abspath('../'))
# sys.path.append(os.path.abspath('static'))
# sys.path.append(os.path.abspath('../'))

# Basic
author = 'eduardotc'
Expand Down Expand Up @@ -45,43 +47,44 @@
'sphinx_reredirects',
'sphinxcontrib.inkscapeconverter',
'sphinx_toolbox.code',
'bokeh.sphinxext.bokeh_dataframe',
]

if shutil.which("inkscape"):
extensions.append("sphinxcontrib.inkscapeconverter")

doctest_global_setup = """
import pandas as pd
import matplotlib.pyplot as plt
mport pytest
import numpy
import matplotlib
import doctest
# doctest_global_setup = """
# import pandas as pd
# import matplotlib.pyplot as plt
# import pytest
# import numpy
# import matplotlib
# import doctest

matplotlib.use('agg', force=True)
# matplotlib.use('agg', force=True)

# Ignore matplotlib output such as `<matplotlib.image.AxesImage at
# 0x7f956908c280>`. doctest monkeypatching inspired by
# https://github.com/wooyek/pytest-doctest-ellipsis-markers (MIT license)
OutputChecker = doctest.OutputChecker
# # Ignore matplotlib output such as `<matplotlib.image.AxesImage at
# # 0x7f956908c280>`. doctest monkeypatching inspired by
# # https://github.com/wooyek/pytest-doctest-ellipsis-markers (MIT license)
# OutputChecker = doctest.OutputChecker

empty_line_markers = ['<matplotlib.', '<mpl_toolkits.mplot3d.']
class SkipMatplotlibOutputChecker(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
for marker in empty_line_markers:
if marker in got:
got = ''
break
return OutputChecker.check_output(self, want, got, optionflags)
# empty_line_markers = ['<matplotlib.', '<mpl_toolkits.mplot3d.']
# class SkipMatplotlibOutputChecker(doctest.OutputChecker):
# def check_output(self, want, got, optionflags):
# for marker in empty_line_markers:
# if marker in got:
# got = ''
# break
# return OutputChecker.check_output(self, want, got, optionflags)


doctest.OutputChecker = SkipMatplotlibOutputChecker
# doctest.OutputChecker = SkipMatplotlibOutputChecker

@pytest.fixture(autouse=True)
def add_np(doctest_namespace):
numpy.random.seed(1)
doctest_namespace['np'] = numpy
"""
# @pytest.fixture(autouse=True)
# def add_np(doctest_namespace):
# numpy.random.seed(1)
# doctest_namespace['np'] = numpy
# """

# Other configs
autoclass_content = 'both'
Expand Down Expand Up @@ -113,6 +116,11 @@ def add_np(doctest_namespace):
inheritance_graph_attrs = dict(dpi=100, size='1000.0', splines='polyline')
inheritance_node_attrs = dict(height=0.02, margin=0.055, penwidth=1,
width=0.01)
panels_css_variables = {
"tabs-color-label-active": "rgb(138, 63, 252)",
"tabs-color-label-inactive": "rgb(221, 225, 230)",
}
plot_html_show_formats = True
unused_docs = []
latex_appendices = []
latex_elements = {'papersize': 'letter'}
Expand All @@ -121,27 +129,45 @@ def add_np(doctest_namespace):
latex_elements['maxlistdepth'] = '10'
latex_elements['pointsize'] = '11pt'
latex_elements['printindex'] = r'\footnotesize\raggedright\printindex'
latex_engine = 'lualatex'
latex_logo = 'logo.png'
# latex_engine = 'lualatex'
latex_logo = 'static/logo.png'
latex_show_urls = 'inline'
latex_show_pagerefs = True
latex_toplevel_sectioning = 'part'
latex_use_modindex = True
# latex_elements = {
# "preamble": dedent(
# r"""
# \directlua{
# luaotfload.add_fallback("fallbacks", {
# "Noto Serif CJK SC:style=Regular;",
# "Symbola:Style=Regular;"
# })
# }

# \setmainfont{FreeSerif}[RawFeature={fallback=fallbacks}]
# """
# )
# }

latex_engine = 'xelatex'
latex_elements = {
"preamble": dedent(
r"""
\directlua{
luaotfload.add_fallback("fallbacks", {
"Noto Serif CJK SC:style=Regular;",
"Symbola:Style=Regular;"
})
}
\setmainfont{FreeSerif}[RawFeature={fallback=fallbacks}]
"""
)
'fontpkg': r'''
\setmainfont{DejaVu Serif}
\setsansfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}
''',
'preamble': r'''
\usepackage[titles]{tocloft}
\cftsetpnumwidth {1.25cm}\cftsetrmarg{1.5cm}
\setlength{\cftchapnumwidth}{0.75cm}
\setlength{\cftsecindent}{\cftchapnumwidth}
\setlength{\cftsecnumwidth}{1.25cm}
''',
'fncychap': r'\usepackage[Bjornstrup]{fncychap}',
'printindex': r'\footnotesize\raggedright\printindex',
}

latex_show_urls = 'footnote'
makeindexfile = True
modindex_common_prefix = ["materials_chempy."]
nitpicky = True
Expand Down Expand Up @@ -173,22 +199,22 @@ def add_np(doctest_namespace):
# >> code
# output
doctest_test_doctest_blocks = "../utils.py ./cli.py \
../database_analysis/dban_functions.py"

# addopts = --doctest-modules
../database_analysis/dban_functions.py \
../cli_utils.py"
addopts = '--doctest-modules'

# doctest_encoding = latin1
doctest_encoding = 'latin1'

doctest_optionflags = (doctest.NORMALIZE_WHITESPACE
| doctest.IGNORE_EXCEPTION_DETAIL)
# doctest_optionflags = (doctest.NORMALIZE_WHITESPACE
# | doctest.IGNORE_EXCEPTION_DETAIL)
# ----------------------------------------------------------------------------------
# Plot directive
# ----------------------------------------------------------------------------------

plot_html_show_formats = False
nbsphinx_timeout = int(os.getenv("QISKIT_CELL_TIMEOUT", "300"))
nbsphinx_execute = os.getenv("QISKIT_DOCS_BUILD_TUTORIALS", "never")
nbsphinx_widgets_path = ""
# plot_html_show_formats = False
# nbsphinx_timeout = int(os.getenv("QISKIT_CELL_TIMEOUT", "300"))
# nbsphinx_execute = os.getenv("QISKIT_DOCS_BUILD_TUTORIALS", "never")
# nbsphinx_widgets_path = ""

nbsphinx_prolog = """
{% set docname = env.doc2path(env.docname, base=None) %}
Expand Down
Loading

0 comments on commit 29b7dd0

Please sign in to comment.