Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update documentation (e.g. replace depth with weight) #96

Open
hematthi opened this issue Jun 21, 2022 · 0 comments
Open

update documentation (e.g. replace depth with weight) #96

hematthi opened this issue Jun 21, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@hematthi
Copy link
Collaborator

""" Return DataFrame with specifications for each chunk which will contain one or more lines.
Input: `line_list` a DataFrame with:
- `lambda_lo`, `lambda_hi`, `lambda`, `depth`
Output: DataFrame with
- `lambda_lo` & `lambda_hi`: boundaries for chunk
- `lambda` & `line_depths`: arrays with info about each line
"""
function merge_chunks(line_list::DataFrame)
@assert hasproperty(line_list,:lambda_lo)
@assert hasproperty(line_list,:lambda_hi)
@assert hasproperty(line_list,:lambda)
#@assert hasproperty(line_list,:depth)
@assert hasproperty(line_list,:weight)
chunk_list_df = DataFrame(:lambda_lo=>Float64[],:lambda_hi=>Float64[],
:lambda=>Array{Float64,1}[],:weight=>Array{Float64,1}[])
num_lines = size(line_list,1)
@assert num_lines >= 2
lambda_lo_last = line_list[1,:lambda_lo]
lambda_hi_last = line_list[1,:lambda_hi]
lambda = [line_list[1,:lambda]]
line_weights = [line_list[1,:weight]]
for i in 2:num_lines
lambda_lo = line_list[i,:lambda_lo]
lambda_hi = line_list[i,:lambda_hi]
if lambda_lo>lambda_hi_last
push!(chunk_list_df, (lambda_lo_last, lambda_hi_last, lambda, line_weights))
(lambda_lo_last, lambda_hi_last) = (lambda_lo, lambda_hi)
lambda = [line_list[i,:lambda]]
line_weights = [line_list[i,:weight]]
else
lambda_hi_last = lambda_hi
push!(lambda,line_list[i,:lambda])
push!(line_weights,line_list[i,:weight])
end
end
if chunk_list_df[end,:lambda_hi] != lambda_hi_last
#push!(chunk_list_df, (lambda_lo_last, lambda_hi_last))
push!(chunk_list_df, (lambda_lo_last, lambda_hi_last, lambda, line_weights))
end
return chunk_list_df
end

@hematthi hematthi added the documentation Improvements or additions to documentation label Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant