From f3fea9c18c5b323f1034fbcaf56064a01c1a0c8c Mon Sep 17 00:00:00 2001 From: AmandaWasserman Date: Mon, 11 Mar 2024 16:05:32 -0700 Subject: [PATCH] create file to read dash outputs --- resspect/read_dash.py | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 resspect/read_dash.py diff --git a/resspect/read_dash.py b/resspect/read_dash.py new file mode 100644 index 00000000..ffb6dd2f --- /dev/null +++ b/resspect/read_dash.py @@ -0,0 +1,49 @@ +# Copyright 2020 resspect software +# Author: Amanda Wasserman +# +# created on 11 March 2024 +# +# Licensed GNU General Public License v3.0; +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.gnu.org/licenses/gpl-3.0.en.html +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#import logging +#import numpy as np +#import pandas as pd +import csv + +__all__ = ["get_id_type"] + + + + +def get_id_type(file='/Users/arw/Desktop/spec_sims_binned_spaced/DASH_matches.txt'): + #read text file + data = open(file, "r") + + #retrieve lines with id and type + sns =[] + for line in data: + if '.txt' in line: + sns.append(line) + + ids = [id[0:7] for id in sns] + + type = [] + #parse file for type + for obj in sns: + indxb = obj.find("('") + indxe = obj.find(") ") + temp = obj[indxb+2:indxe] + temp = temp.split(',')[0] + type.append(temp[0:-1]) + return ids, type +