Code Monkey home page Code Monkey logo

Comments (10)

IhsanKhaliq avatar IhsanKhaliq commented on August 30, 2024

Are you combining events in one_day function? If so, all these events can't possibly happen in a day. I checked the functions code, they seem logical in this order. Also, in the field spores are spread from infested stubble by rain splash and then they fall on host/get intercepted and finally infect. I am not if random integer from real is important. spores_each_wet_hour ->-> potentially_effective_spores ->-> spores_from_1_element ->-> splash_distance->-> splash_angle ->-> wind_distance ->-> wind_angle ->-> address_from_center_distance -> -> address_from_center_distance ->-> interception_probability ->-> adjust_for_interception ->-> successful_infections . I think it might be easier to divide functions based on

from ascotracer.

IhsanKhaliq avatar IhsanKhaliq commented on August 30, 2024

Or you meant one_season function?

from ascotracer.

PaulMelloy avatar PaulMelloy commented on August 30, 2024

I mean to keep most of the functions but organise them so they are not nested to the extent they currently are. So dropping down 3-4 layers of functions instead of the 7 as partially described above I think this will make it easier to maintain and make the code more readable.
Ultimately the model will be run with one function. I think it would be easier to run the season at the first function level, changing one_day to a loop function that apply a grow function, then disperse function, then interception/infection function in order. That would reduce nesting from ~ 7 to 4-5. Which, in my opinion, would be more ideal, easier to follow and debug.

ie something like this
Old
Season
-> day_in_season
->-> hour_in_day
->->-> grid_element()
->->->-> growing_point()
-> day_in_season
->-> hour_in_day
->->-> grid_element()
->->->-> disperse_spores()
-> day_in_season
->-> hour_in_day
->->-> grid_element()
->->->-> intercept_and_infect()

New
trace_asco (Season)
loop_day{
-> apply(grid_elements , grow_plants())
-> apply(grid_elements , disperse_infected()
-> apply(grid_elements , interception_infect()
}

from ascotracer.

IhsanKhaliq avatar IhsanKhaliq commented on August 30, 2024

Okay. I'd change infected to spores. That is, spread_spores and intercept_spores because spores are being spread and intercepted (disease can't possibly be intercepted, once diseased, the story is over). That said, spore interception function may not be very relevant in our case as we're studying in splash dispersal within paddock, so spores should always fall on chickpea/host

from ascotracer.

adamhsparks avatar adamhsparks commented on August 30, 2024

lintr is a good package to use to help you sort out the complexity of the functions, the cyclomatic complexity can be calculated and you can then gauge from there what could improve the code: https://github.com/jimhester/lintr

from ascotracer.

PaulMelloy avatar PaulMelloy commented on August 30, 2024

Thanks Adam!

from ascotracer.

PaulMelloy avatar PaulMelloy commented on August 30, 2024

@IhsanKhaliq can you post a link to the graphic you have of the model please

from ascotracer.

IhsanKhaliq avatar IhsanKhaliq commented on August 30, 2024

02whole-pages-145-189.pdf

https://digital.library.adelaide.edu.au/dspace/bitstream/2440/75702/8/02whole.pdf Graphics are at the end of chapter 7 for of this thesis. I have already cut chapter 7 from the whole thesis for convenience

from ascotracer.

IhsanKhaliq avatar IhsanKhaliq commented on August 30, 2024

Screen Shot 2021-02-15 at 1 44 16 pm
Please see different color elipses representing different parameters

from ascotracer.

IhsanKhaliq avatar IhsanKhaliq commented on August 30, 2024

Done in trace_asco() & `one_day()" function

from ascotracer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.