{"action":"created","comment":{"url":"https://api.github.com/repos/materialsproject/pymatgen/pulls/comments/133833555","pull_request_review_id":57060594,"id":133833555,"diff_hunk":"@@ -0,0 +1,161 @@\n+# coding: utf-8\n+# Copyright (c) Pymatgen Development Team.\n+# Distributed under the terms of the MIT License.\n+\n+from monty.json import MSONable\n+import abc\n+from scipy.interpolate import interp1d\n+from pymatgen.symmetry.analyzer import SpacegroupAnalyzer\n+from pymatgen import Structure\n+import json\n+import numpy as np\n+\n+\"\"\"\n+This module defines classes to represent all spectra\n+\"\"\"\n+\n+__author__ = \"Chen Zheng\"\n+__copyright__ = \"Copyright 2012, The Materials Project\"\n+__version__ = \"2.0\"\n+__maintainer__ = \"Chen Zheng\"\n+__email__ = \"chz022@ucsd.edu\"\n+__date__ = \"Aug 9, 2017\"\n+\n+\n+class Spectrum(abc.ABC):\n+    \"\"\"\n+    Base class for Xanespectrum and Exafspectrum.\n+    Not meant to be instantiated directly\n+    \"\"\"\n+\n+    @property\n+    def spectrum_structure(self):\n+        \"\"\"\n+        Returns the structure associated with the spectrum\n+        \"\"\"\n+        return self.structure\n+\n+    @property\n+    def spectrum_type(self):\n+        \"\"\"\n+        Returns the spectrum type\n+        \"\"\"\n+        return self.type\n+\n+    @property\n+    def spectrum_data(self):\n+        \"\"\"\n+        Returns the spectrum\n+        \"\"\"\n+        return self.spectrum\n+\n+    @classmethod\n+    @abc.abstractmethod\n+    def from_file(cls, filename):\n+        \"\"\"\n+        Initiate Spectrum from a filename\n+        \"\"\"\n+        pass\n+\n+\n+class Xanespectrum(Spectrum, MSONable):\n+    def __init__(self, formula, absorption_specie, edge, structure, spectrum):\n+        \"\"\"\n+        Create a XANES spectrum object\n+        :param formula: The reduced formula of the structure associated with the spectrum\n+        :param absorption_specie: absorption specie of the spectrum\n+        :param edge: absorption spectrum edge\n+        :param structure: materials structure associated with the spectrum, need to be a pymatgen structure object\n+        :param spectrum: Spectrum data\n+        \"\"\"\n+\n+        self.formula = formula\n+        self.absorption_specie = absorption_specie\n+        self.edge = edge\n+        self.structure = structure\n+        self.spectrum = spectrum\n+\n+\n+class XanesFEFF(Xanespectrum):","path":"pymatgen/analysis/spectra/spectrum.py","position":79,"original_position":79,"commit_id":"9a30c9ff8fa2cdcf425552546f47f73c176d85a8","original_commit_id":"9a30c9ff8fa2cdcf425552546f47f73c176d85a8","user":{"login":"shyuep","id":577107,"avatar_url":"https://avatars3.githubusercontent.com/u/577107?v=4","gravatar_id":"","url":"https://api.github.com/users/shyuep","html_url":"https://github.com/shyuep","followers_url":"https://api.github.com/users/shyuep/followers","following_url":"https://api.github.com/users/shyuep/following{/other_user}","gists_url":"https://api.github.com/users/shyuep/gists{/gist_id}","starred_url":"https://api.github.com/users/shyuep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shyuep/subscriptions","organizations_url":"https://api.github.com/users/shyuep/orgs","repos_url":"https://api.github.com/users/shyuep/repos","events_url":"https://api.github.com/users/shyuep/events{/privacy}","received_events_url":"https://api.github.com/users/shyuep/received_events","type":"User","site_admin":false},"body":"Note that things like dir_name and FEFF input parameters generally should not be stored in the class. Since when do we do this for any pymatgen analysis object? If you wish, you can have the XANES object take in a `provenance` optional kwarg. That can store things like whether it is calculated by FEFF or whatever code with what parameters. Most of the methods within the XANES object should not operate on provenace data.\r\n\r\nJust think about the Dos object. Do I classify it as a VASP DOS? I don't! Density of states is a generic concept that can be generated by VASP, ABINIT and many other codes. The DOS object needs to be flexible enough to deal with all of this. The computational code specific stuff should be part of the io parsing, but not pollute analysis. The way I would analyze a VASP generated DOS is the same as I would do for a ABINIT generated one.\r\n\r\nBased on your strategy, you are going to have tends of XANES object each catering to one type of computational code and repeating the exact same methods. That is ridiculous.","created_at":"2017-08-17T21:26:44Z","updated_at":"2017-08-17T21:26:44Z","html_url":"https://github.com/materialsproject/pymatgen/pull/776#discussion_r133833555","pull_request_url":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776","_links":{"self":{"href":"https://api.github.com/repos/materialsproject/pymatgen/pulls/comments/133833555"},"html":{"href":"https://github.com/materialsproject/pymatgen/pull/776#discussion_r133833555"},"pull_request":{"href":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776"}}},"pull_request":{"url":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776","id":136339137,"html_url":"https://github.com/materialsproject/pymatgen/pull/776","diff_url":"https://github.com/materialsproject/pymatgen/pull/776.diff","patch_url":"https://github.com/materialsproject/pymatgen/pull/776.patch","issue_url":"https://api.github.com/repos/materialsproject/pymatgen/issues/776","number":776,"state":"open","locked":false,"title":"Initialization of spectrum module","user":{"login":"czhengsci","id":7264656,"avatar_url":"https://avatars0.githubusercontent.com/u/7264656?v=4","gravatar_id":"","url":"https://api.github.com/users/czhengsci","html_url":"https://github.com/czhengsci","followers_url":"https://api.github.com/users/czhengsci/followers","following_url":"https://api.github.com/users/czhengsci/following{/other_user}","gists_url":"https://api.github.com/users/czhengsci/gists{/gist_id}","starred_url":"https://api.github.com/users/czhengsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czhengsci/subscriptions","organizations_url":"https://api.github.com/users/czhengsci/orgs","repos_url":"https://api.github.com/users/czhengsci/repos","events_url":"https://api.github.com/users/czhengsci/events{/privacy}","received_events_url":"https://api.github.com/users/czhengsci/received_events","type":"User","site_admin":false},"body":"## Summary\r\n\r\nInitial commit of pymatgen.analysis.spectra module\r\n\r\n* Add Spectrum base abstract class\r\n* Add XanesFEFF class\r\n* Add unittest for XaneFEFF \r\n\r\n## TODO (if any)\r\n\r\n- [ ]  Add ExafsFEFF class \r\n- [ ]  Add more spectrum preprosessing methods\r\n- [ ]  Peak detection method for spectrum","created_at":"2017-08-17T19:52:48Z","updated_at":"2017-08-17T21:26:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b6645ae822234a2e18b9866ba84fc6bb19beacb","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776/commits","review_comments_url":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776/comments","review_comment_url":"https://api.github.com/repos/materialsproject/pymatgen/pulls/comments{/number}","comments_url":"https://api.github.com/repos/materialsproject/pymatgen/issues/776/comments","statuses_url":"https://api.github.com/repos/materialsproject/pymatgen/statuses/9a30c9ff8fa2cdcf425552546f47f73c176d85a8","head":{"label":"czhengsci:spectrum","ref":"spectrum","sha":"9a30c9ff8fa2cdcf425552546f47f73c176d85a8","user":{"login":"czhengsci","id":7264656,"avatar_url":"https://avatars0.githubusercontent.com/u/7264656?v=4","gravatar_id":"","url":"https://api.github.com/users/czhengsci","html_url":"https://github.com/czhengsci","followers_url":"https://api.github.com/users/czhengsci/followers","following_url":"https://api.github.com/users/czhengsci/following{/other_user}","gists_url":"https://api.github.com/users/czhengsci/gists{/gist_id}","starred_url":"https://api.github.com/users/czhengsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czhengsci/subscriptions","organizations_url":"https://api.github.com/users/czhengsci/orgs","repos_url":"https://api.github.com/users/czhengsci/repos","events_url":"https://api.github.com/users/czhengsci/events{/privacy}","received_events_url":"https://api.github.com/users/czhengsci/received_events","type":"User","site_admin":false},"repo":{"id":99834123,"name":"pymatgen","full_name":"czhengsci/pymatgen","owner":{"login":"czhengsci","id":7264656,"avatar_url":"https://avatars0.githubusercontent.com/u/7264656?v=4","gravatar_id":"","url":"https://api.github.com/users/czhengsci","html_url":"https://github.com/czhengsci","followers_url":"https://api.github.com/users/czhengsci/followers","following_url":"https://api.github.com/users/czhengsci/following{/other_user}","gists_url":"https://api.github.com/users/czhengsci/gists{/gist_id}","starred_url":"https://api.github.com/users/czhengsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czhengsci/subscriptions","organizations_url":"https://api.github.com/users/czhengsci/orgs","repos_url":"https://api.github.com/users/czhengsci/repos","events_url":"https://api.github.com/users/czhengsci/events{/privacy}","received_events_url":"https://api.github.com/users/czhengsci/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/czhengsci/pymatgen","description":"Python Materials Genomics (pymatgen) is a robust materials analysis code that defines core object representations for structures and molecules with support for many electronic structure codes. It is currently the core analysis code powering the Materials Project.","fork":true,"url":"https://api.github.com/repos/czhengsci/pymatgen","forks_url":"https://api.github.com/repos/czhengsci/pymatgen/forks","keys_url":"https://api.github.com/repos/czhengsci/pymatgen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/czhengsci/pymatgen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/czhengsci/pymatgen/teams","hooks_url":"https://api.github.com/repos/czhengsci/pymatgen/hooks","issue_events_url":"https://api.github.com/repos/czhengsci/pymatgen/issues/events{/number}","events_url":"https://api.github.com/repos/czhengsci/pymatgen/events","assignees_url":"https://api.github.com/repos/czhengsci/pymatgen/assignees{/user}","branches_url":"https://api.github.com/repos/czhengsci/pymatgen/branches{/branch}","tags_url":"https://api.github.com/repos/czhengsci/pymatgen/tags","blobs_url":"https://api.github.com/repos/czhengsci/pymatgen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/czhengsci/pymatgen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/czhengsci/pymatgen/git/refs{/sha}","trees_url":"https://api.github.com/repos/czhengsci/pymatgen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/czhengsci/pymatgen/statuses/{sha}","languages_url":"https://api.github.com/repos/czhengsci/pymatgen/languages","stargazers_url":"https://api.github.com/repos/czhengsci/pymatgen/stargazers","contributors_url":"https://api.github.com/repos/czhengsci/pymatgen/contributors","subscribers_url":"https://api.github.com/repos/czhengsci/pymatgen/subscribers","subscription_url":"https://api.github.com/repos/czhengsci/pymatgen/subscription","commits_url":"https://api.github.com/repos/czhengsci/pymatgen/commits{/sha}","git_commits_url":"https://api.github.com/repos/czhengsci/pymatgen/git/commits{/sha}","comments_url":"https://api.github.com/repos/czhengsci/pymatgen/comments{/number}","issue_comment_url":"https://api.github.com/repos/czhengsci/pymatgen/issues/comments{/number}","contents_url":"https://api.github.com/repos/czhengsci/pymatgen/contents/{+path}","compare_url":"https://api.github.com/repos/czhengsci/pymatgen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/czhengsci/pymatgen/merges","archive_url":"https://api.github.com/repos/czhengsci/pymatgen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/czhengsci/pymatgen/downloads","issues_url":"https://api.github.com/repos/czhengsci/pymatgen/issues{/number}","pulls_url":"https://api.github.com/repos/czhengsci/pymatgen/pulls{/number}","milestones_url":"https://api.github.com/repos/czhengsci/pymatgen/milestones{/number}","notifications_url":"https://api.github.com/repos/czhengsci/pymatgen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/czhengsci/pymatgen/labels{/name}","releases_url":"https://api.github.com/repos/czhengsci/pymatgen/releases{/id}","deployments_url":"https://api.github.com/repos/czhengsci/pymatgen/deployments","created_at":"2017-08-09T17:17:21Z","updated_at":"2017-08-09T17:17:30Z","pushed_at":"2017-08-17T19:38:20Z","git_url":"git://github.com/czhengsci/pymatgen.git","ssh_url":"git@github.com:czhengsci/pymatgen.git","clone_url":"https://github.com/czhengsci/pymatgen.git","svn_url":"https://github.com/czhengsci/pymatgen","homepage":"http://www.pymatgen.org","size":243114,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"materialsproject:master","ref":"master","sha":"340856ab0abb31102e3d26608a927a0af015c514","user":{"login":"materialsproject","id":867057,"avatar_url":"https://avatars3.githubusercontent.com/u/867057?v=4","gravatar_id":"","url":"https://api.github.com/users/materialsproject","html_url":"https://github.com/materialsproject","followers_url":"https://api.github.com/users/materialsproject/followers","following_url":"https://api.github.com/users/materialsproject/following{/other_user}","gists_url":"https://api.github.com/users/materialsproject/gists{/gist_id}","starred_url":"https://api.github.com/users/materialsproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/materialsproject/subscriptions","organizations_url":"https://api.github.com/users/materialsproject/orgs","repos_url":"https://api.github.com/users/materialsproject/repos","events_url":"https://api.github.com/users/materialsproject/events{/privacy}","received_events_url":"https://api.github.com/users/materialsproject/received_events","type":"Organization","site_admin":false},"repo":{"id":2629302,"name":"pymatgen","full_name":"materialsproject/pymatgen","owner":{"login":"materialsproject","id":867057,"avatar_url":"https://avatars3.githubusercontent.com/u/867057?v=4","gravatar_id":"","url":"https://api.github.com/users/materialsproject","html_url":"https://github.com/materialsproject","followers_url":"https://api.github.com/users/materialsproject/followers","following_url":"https://api.github.com/users/materialsproject/following{/other_user}","gists_url":"https://api.github.com/users/materialsproject/gists{/gist_id}","starred_url":"https://api.github.com/users/materialsproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/materialsproject/subscriptions","organizations_url":"https://api.github.com/users/materialsproject/orgs","repos_url":"https://api.github.com/users/materialsproject/repos","events_url":"https://api.github.com/users/materialsproject/events{/privacy}","received_events_url":"https://api.github.com/users/materialsproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/materialsproject/pymatgen","description":"Python Materials Genomics (pymatgen) is a robust materials analysis code that defines core object representations for structures and molecules with support for many electronic structure codes. It is currently the core analysis code powering the Materials Project.","fork":false,"url":"https://api.github.com/repos/materialsproject/pymatgen","forks_url":"https://api.github.com/repos/materialsproject/pymatgen/forks","keys_url":"https://api.github.com/repos/materialsproject/pymatgen/keys{/key_id}","collaborators_url":"https://api.github.com/repos/materialsproject/pymatgen/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/materialsproject/pymatgen/teams","hooks_url":"https://api.github.com/repos/materialsproject/pymatgen/hooks","issue_events_url":"https://api.github.com/repos/materialsproject/pymatgen/issues/events{/number}","events_url":"https://api.github.com/repos/materialsproject/pymatgen/events","assignees_url":"https://api.github.com/repos/materialsproject/pymatgen/assignees{/user}","branches_url":"https://api.github.com/repos/materialsproject/pymatgen/branches{/branch}","tags_url":"https://api.github.com/repos/materialsproject/pymatgen/tags","blobs_url":"https://api.github.com/repos/materialsproject/pymatgen/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/materialsproject/pymatgen/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/materialsproject/pymatgen/git/refs{/sha}","trees_url":"https://api.github.com/repos/materialsproject/pymatgen/git/trees{/sha}","statuses_url":"https://api.github.com/repos/materialsproject/pymatgen/statuses/{sha}","languages_url":"https://api.github.com/repos/materialsproject/pymatgen/languages","stargazers_url":"https://api.github.com/repos/materialsproject/pymatgen/stargazers","contributors_url":"https://api.github.com/repos/materialsproject/pymatgen/contributors","subscribers_url":"https://api.github.com/repos/materialsproject/pymatgen/subscribers","subscription_url":"https://api.github.com/repos/materialsproject/pymatgen/subscription","commits_url":"https://api.github.com/repos/materialsproject/pymatgen/commits{/sha}","git_commits_url":"https://api.github.com/repos/materialsproject/pymatgen/git/commits{/sha}","comments_url":"https://api.github.com/repos/materialsproject/pymatgen/comments{/number}","issue_comment_url":"https://api.github.com/repos/materialsproject/pymatgen/issues/comments{/number}","contents_url":"https://api.github.com/repos/materialsproject/pymatgen/contents/{+path}","compare_url":"https://api.github.com/repos/materialsproject/pymatgen/compare/{base}...{head}","merges_url":"https://api.github.com/repos/materialsproject/pymatgen/merges","archive_url":"https://api.github.com/repos/materialsproject/pymatgen/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/materialsproject/pymatgen/downloads","issues_url":"https://api.github.com/repos/materialsproject/pymatgen/issues{/number}","pulls_url":"https://api.github.com/repos/materialsproject/pymatgen/pulls{/number}","milestones_url":"https://api.github.com/repos/materialsproject/pymatgen/milestones{/number}","notifications_url":"https://api.github.com/repos/materialsproject/pymatgen/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/materialsproject/pymatgen/labels{/name}","releases_url":"https://api.github.com/repos/materialsproject/pymatgen/releases{/id}","deployments_url":"https://api.github.com/repos/materialsproject/pymatgen/deployments","created_at":"2011-10-23T04:10:39Z","updated_at":"2017-08-08T14:46:16Z","pushed_at":"2017-08-17T21:08:32Z","git_url":"git://github.com/materialsproject/pymatgen.git","ssh_url":"git@github.com:materialsproject/pymatgen.git","clone_url":"https://github.com/materialsproject/pymatgen.git","svn_url":"https://github.com/materialsproject/pymatgen","homepage":"http://www.pymatgen.org","size":245725,"stargazers_count":185,"watchers_count":185,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":214,"mirror_url":null,"open_issues_count":28,"forks":214,"open_issues":28,"watchers":185,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776"},"html":{"href":"https://github.com/materialsproject/pymatgen/pull/776"},"issue":{"href":"https://api.github.com/repos/materialsproject/pymatgen/issues/776"},"comments":{"href":"https://api.github.com/repos/materialsproject/pymatgen/issues/776/comments"},"review_comments":{"href":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776/comments"},"review_comment":{"href":"https://api.github.com/repos/materialsproject/pymatgen/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/materialsproject/pymatgen/pulls/776/commits"},"statuses":{"href":"https://api.github.com/repos/materialsproject/pymatgen/statuses/9a30c9ff8fa2cdcf425552546f47f73c176d85a8"}}}}
{"actor":{"display_login":"shyuep"}}