#245 Waterdeprivation Issues

Closed
opened 3 months ago by maristany · 5 comments

Hi Jan,

bei der wasserdeprivation gibt es ein problem.

Problem1: es gibt immer 3 tage pause am 'Wochenende' es sollten nur 2 sein.

Problem2: Das ist das etwas größere. Lets say I typed in:

Start_Waterdeprivation: 12 Duration: 34

Grad ist es so, dass die Wasserdeprivation Bei overall_tag 34 aufhört. Sie sollte aber bei tag 12+34 = 48 aufhören. Das heißt gerade sieht es im scoresheet als wären da nur 22 (34-12) tage wasserdeprivation da.

das heißt bei der Bestimmung der Länge der Wasserdeprivation Tagen muss man noch den Offset des Start_Waterdeprivation datum berechnen.

Hi Jan, bei der wasserdeprivation gibt es ein problem. Problem1: es gibt immer 3 tage pause am 'Wochenende' es sollten nur 2 sein. Problem2: Das ist das etwas größere. Lets say I typed in: Start_Waterdeprivation: 12 Duration: 34 Grad ist es so, dass die Wasserdeprivation Bei overall_tag 34 aufhört. Sie sollte aber bei tag 12+34 = 48 aufhören. Das heißt gerade sieht es im scoresheet als wären da nur 22 (34-12) tage wasserdeprivation da. das heißt bei der Bestimmung der Länge der Wasserdeprivation Tagen muss man noch den Offset des Start_Waterdeprivation datum berechnen.
Jan van Dick commented 3 months ago
Owner

Hmm, irgendwie komisch, weil ich das gefühl habe, das wir an der Frage der Länge schon so viel hin und her geschoben haben.

Ich schaue gleich mal rein

Hmm, irgendwie komisch, weil ich das gefühl habe, das wir an der Frage der Länge schon so viel hin und her geschoben haben. Ich schaue gleich mal rein

dankee! und bei manchen Tieren taucht die Wasserdeprivation gar nicht auf im score sheet (und das gewicht geht gar nicht runter).

bsp. MLA-023346

für das obere problem ist das tier: MLA-023400

dankee! und bei manchen Tieren taucht die Wasserdeprivation gar nicht auf im score sheet (und das gewicht geht gar nicht runter). bsp. MLA-023346 für das obere problem ist das tier: MLA-023400

I think the second might be because the sacrifice date is to soon in comparison with the water deprivation duration. could this be?

I think the second might be because the sacrifice date is to soon in comparison with the water deprivation duration. could this be?
Jan van Dick commented 3 months ago
Owner

This is the current code:

  duration = len(daterange(start_date, sacrifice_date))-1

        # Generate water-control-mask, if watercontrol is allowed:
        if watercontrol_infos.allowed:
            try:
                days_after_start = int(watercontrol_infos.days_after_start)
                water_restriction_start = incdate(start_date, days_after_start)
                surgery_dates = get_surgery_dates(animal_id, general.experiment)
                duration_water = len(daterange(water_restriction_start, sacrifice_date))
                if duration_water > int(watercontrol_infos.duration):
                    duration_water = int(watercontrol_infos.duration)
                if duration_water > duration:
                    duration_water = duration
            except ValueError: 
                raise MissingEntryException(
                    "The matching protocol has invalid entries for watercontrol."
                )
            # Calculate water-control-mask and estimated weights
            water_control_mask = get_water_control_mask(
                water_restriction_start, duration_water, surgery_dates, sacrificed=True
            )
            # Add `False`-values for days_after_start  
            water_control_mask = [False for _ in range(days_after_start-1)] + water_control_mask
            water_control_mask = water_control_mask + [
                False for _ in range(duration-(len(water_control_mask)-1))
            ]
        else:
            water_control_mask = [False for _ in range(duration+1)]
        # Generate estimated weights 
        print(len(water_control_mask), duration)
        estimated_weights = get_estimated_weight_list(
            age_at_start, animal_data.sex, duration, water_control_mask, start_weight
        )
        weights = apply_noise(estimated_weights, 0.070, start_weight==-1)

        # Update general data:
        general.watercontrol_mask = json.dumps(water_control_mask)
        general.weights = json.dumps(weights)
        general.set_start_weight(round(estimated_weights[0], 2))
This is the current code: ``` duration = len(daterange(start_date, sacrifice_date))-1 # Generate water-control-mask, if watercontrol is allowed: if watercontrol_infos.allowed: try: days_after_start = int(watercontrol_infos.days_after_start) water_restriction_start = incdate(start_date, days_after_start) surgery_dates = get_surgery_dates(animal_id, general.experiment) duration_water = len(daterange(water_restriction_start, sacrifice_date)) if duration_water > int(watercontrol_infos.duration): duration_water = int(watercontrol_infos.duration) if duration_water > duration: duration_water = duration except ValueError: raise MissingEntryException( "The matching protocol has invalid entries for watercontrol." ) # Calculate water-control-mask and estimated weights water_control_mask = get_water_control_mask( water_restriction_start, duration_water, surgery_dates, sacrificed=True ) # Add `False`-values for days_after_start water_control_mask = [False for _ in range(days_after_start-1)] + water_control_mask water_control_mask = water_control_mask + [ False for _ in range(duration-(len(water_control_mask)-1)) ] else: water_control_mask = [False for _ in range(duration+1)] # Generate estimated weights print(len(water_control_mask), duration) estimated_weights = get_estimated_weight_list( age_at_start, animal_data.sex, duration, water_control_mask, start_weight ) weights = apply_noise(estimated_weights, 0.070, start_weight==-1) # Update general data: general.watercontrol_mask = json.dumps(water_control_mask) general.weights = json.dumps(weights) general.set_start_weight(round(estimated_weights[0], 2)) ```
Jan van Dick commented 3 months ago
Owner

The problem that you describe, does it only occur in the score sheet, or in the graph and weighlist viewed in FLAKE too?

The problem that you describe, does it only occur in the score sheet, or in the graph and weighlist viewed in FLAKE too?
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.