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
23 changes: 23 additions & 0 deletions news/new_parser_api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* import `loadData` and `deserialize_data` directly to integrate with `diffpy.utils(3.6.0)`

**Security:**

* <news item>
11 changes: 6 additions & 5 deletions src/diffpy/pdfmorph/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import numpy

import diffpy.utils.parsers as parsers
from diffpy.utils.parsers.loaddata import loadData
from diffpy.utils.parsers.serialization import deserialize_data


def estimateScale(y_morph_in, y_target_in):
Expand Down Expand Up @@ -117,7 +118,7 @@ def readPDF(fname):
Arrays read from data.
"""

rv = parsers.loaddata.loadData(fname, unpack=True)
rv = loadData(fname, unpack=True)
if len(rv) >= 2:
return rv[:2]
return (None, None)
Expand Down Expand Up @@ -145,7 +146,7 @@ def deserialize(serial_file):
dict
Data read from serial file.
"""
return parsers.serialization.deserialize_data(serial_file)
return deserialize_data(serial_file)


def case_insensitive_dictionary_search(key: str, dictionary: dict):
Expand Down Expand Up @@ -199,11 +200,11 @@ def field_sort(filepaths: list, field, reverse=False, serfile=None, get_field_va
files_field_values = []
if serfile is None:
for path in filepaths:
fhd = parsers.loaddata.loadData(path, headers=True)
fhd = loadData(path, headers=True)
files_field_values.append([path, case_insensitive_dictionary_search(field, fhd)])
else:
# deserialize the serial file
des_dict = parsers.serialization.deserialize_data(serfile)
des_dict = deserialize_data(serfile)

# get names of each file to search the serial file
import pathlib
Expand Down
Loading