Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/11bf2329590e7b0164ba/maintainability)](https://codeclimate.com/github/hed-standard/hed-python/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/11bf2329590e7b0164ba/test_coverage)](https://codeclimate.com/github/hed-standard/hed-python/test_coverage)
![PyPI - Status](https://img.shields.io/pypi/v/hedtools)

[![Documentation Status](https://readthedocs.org/projects/hed-python/badge/?version=latest)](https://hed-python.readthedocs.io/en/latest/?badge=latest)

# HEDTools - Python
HED (Hierarchical Event Descriptors) is a framework for systematically describing
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ openpyxl>=3.1.0
pandas>=1.3.5
portalocker>=2.7.0
semantic_version>=2.10.0
myst-parser>=1.0.0
Sphinx>=5.2.2
sphinx_rtd_theme>=1.0.0
wordcloud==1.9.2
Binary file added docs/source/_static/images/croppedWideLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
author = 'HED Working Group'

# The full version, including alpha/beta/rc tags
version = '0.0.1'
release = '0.0.1'
version = '0.3.1'
release = '0.3.1'

currentdir = os.path.realpath(os.path.dirname(__file__))

Expand Down
4 changes: 4 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Hierarchical Event Descriptor (HED) Python Tools
================================================

.. image:: _static/images/croppedWideLogo.png
:width: 220
:alt: HedLogo

.. sidebar:: **Links**

* `PDF docs <https://hed-python.readthedocs.io/_/downloads/en/latest/pdf/>`_
Expand Down
9 changes: 8 additions & 1 deletion docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ you can install directly from the
`GitHub repository <https://github.com/hed-standard/hed-python>`_
using the following command:

```code
>>> pip install git+https://github.com/hed-standard/hed-python.git

```

Finding help
============

:Documentation:

See `HED resources <https://www.hed-resources.org>`_ for user documentation and tutorials.

The `HED online tools <https://hedtools.org>`_ provide an easy-to-use interface that requires no programming.

:Mailing lists and forums:

* Don't hesitate to ask questions about the python hedtools on `NeuroStars
Expand Down
4 changes: 2 additions & 2 deletions hed/models/base_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ def __init__(self, file, file_type=None, worksheet_name=None, has_column_names=T
self._dataframe = None

if isinstance(file, pandas.DataFrame):
self._dataframe = file
self._dataframe = file.astype(str)
self._has_column_names = self._dataframe_has_names(self._dataframe)
elif not file:
raise HedFileError(HedExceptions.FILE_NOT_FOUND, "Empty file passed to BaseInput.", file)
elif input_type in self.TEXT_EXTENSION:
try:
self._dataframe = pandas.read_csv(file, delimiter='\t', header=pandas_header,
dtype=str, keep_default_na=True, na_values=None)
dtype=str, keep_default_na=True, na_values=["", "null"])
except Exception as e:
raise HedFileError(HedExceptions.INVALID_FILE_FORMAT, str(e), self.name) from e
# Convert nan values to a known value
Expand Down
1 change: 1 addition & 0 deletions hed/schema/hed_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def get_formatted_version(self):
Returns:
str: A json formatted string of the complete version of this schema including library name and namespace.
"""

return json.dumps(self.version)

def get_save_header_attributes(self, save_merged=False):
Expand Down
12 changes: 6 additions & 6 deletions hed/tools/util/data_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def get_new_dataframe(data):
DataFrame: A dataframe containing the contents of the tsv file or if data was
a DataFrame to start with, a new copy of the DataFrame.

:raises HedFileError:
:raises HedFileError:
- If a filename is given and it cannot be read into a Dataframe.

"""

if isinstance(data, str):
df = pd.read_csv(data, delimiter='\t', header=0, keep_default_na=False, na_values=",null")
df = pd.read_csv(data, delimiter='\t', header=0, keep_default_na=True, na_values=[",", "null"])
elif isinstance(data, pd.DataFrame):
df = data.copy()
else:
Expand All @@ -155,7 +155,7 @@ def get_row_hash(row, key_list):
Returns:
str: Hash key constructed from the entries of row in the columns specified by key_list.

:raises HedFileError:
:raises HedFileError:
- If row doesn't have all of the columns in key_list HedFileError is raised.

"""
Expand All @@ -177,7 +177,7 @@ def get_value_dict(tsv_path, key_col='file_basename', value_col='sampling_rate')
Returns:
dict: Dictionary with key_col values as the keys and the corresponding value_col values as the values.

:raises HedFileError:
:raises HedFileError:
- When tsv_path does not correspond to a file that can be read into a DataFrame.

"""
Expand Down Expand Up @@ -252,7 +252,7 @@ def reorder_columns(data, col_order, skip_missing=True):
Returns:
DataFrame: A new reordered dataframe.

:raises HedFileError:
:raises HedFileError:
- If col_order contains columns not in data and skip_missing is False.
- If data corresponds to a filename from which a dataframe cannot be created.

Expand All @@ -277,7 +277,7 @@ def separate_values(values, target_values):
list: Target values present in values.
list: Target values missing from values.

Notes:
Notes:
- The function computes the set difference of target_cols and base_cols and returns a list
of columns of target_cols that are in base_cols and a list of those missing.

Expand Down