forked from COINtoolbox/RESSPECT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74132fd
commit f3fea9c
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|