Commit 117b4031 authored by Roelofsen, Hans's avatar Roelofsen, Hans
Browse files

suggestie MarliesS voor optima bepaling

parent 9a51fc60
......@@ -97,16 +97,22 @@ class AbioticOptimum:
if species_response > 0:
response_df.loc[i, 'n_species'] = response_df.loc[i, 'n_species'] + 1
# Score is the summed species response PLUS number of species with response > 0
response_df['score'] = response_df.sum(axis=1)
# The optimal abiotic condition is where:
# first the response_sum is highest
# then the n_species is highest
# then the lowest abiotic value
# Note: dit is zoals gesuggereerd door Marlies Sanders, 7 mrt 2022
top_score = response_df.response_sum.max()
abiotic_optimum = response_df.loc[response_df.response_sum == top_score, 'n_species'].idxmax()
n_with_optimum = response_df.loc[response_df.response_sum ==top_score].shape[0]
# Score is the summed species response PLUS number of species with response > 0
# Dit is een alternatieve methode.
# response_df['score'] = response_df.sum(axis=1)
# Determine top score and corresponding abiotic condition value
top_score = response_df.score.max()
abiotic_optimum = response_df.score.idxmax() # First occurence of maximum
n_with_optimum = response_df.loc[response_df.score == top_score].shape[0]
# TODO: alternatieve manier voor optimum bepalen, suggestie Marlies S, 20220307
# eerst hoogste response_sum, daarbinnen hoogste n_species. Bij gelijkspel: laagste abiotiek
# top_score = response_df.score.max()
# abiotic_optimum = response_df.score.idxmax() # First occurence of maximum
# n_with_optimum = response_df.loc[response_df.score == top_score].shape[0]
msg = '{0} optimum for {1} is {2}'.format(abiotic_condition, bt, abiotic_optimum)
if verbose:
......@@ -250,7 +256,7 @@ if __name__ == '__main__':
parser_b.add_argument('bt', help='Beheertype code', type=str)
parser_b.add_argument('--of', help='output format', type=str, choices=['tuple', 'df', 'dict', 'single', 'str'],
default='str')
parser_b.add_argument('--sp_list', help='which species list', type=int, choices=[146, 281, 468], default=146)
parser_b.add_argument('--sp_list', help='which species list', type=int, choices=[146, 281, 468], default=281)
parser_b.set_defaults(func=query4bt)
# Subparser for abiotic range of a Species
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment